How do i turn selectionSortType into a template classSolutio

How do i turn selectionSortType into a template class?

Solution

Answer:

Add the keyword \'template\' before every definition and then put template arguments between <> . For example :

put template<typename T> before every definition and replace every type with \'T\'.

void selectionSortType::setUnsortedList (const int list[], int size) becomes :

template <typename T> void selectionSortType::setUnsortedList (const T list[], int size) . Same goes for the rest.

How do i turn selectionSortType into a template class?SolutionAnswer: Add the keyword \'template\' before every definition and then put template arguments betwe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site