I sorry if similar question already exists on this forum, if you could, give me the link.
I have a template class
template<typename type>
class DoublyLinkedList {};
And I want to have Sort method in it.
template<typename type>
class DoublyLinkedList
{
public:
void Sort(){}
};
But list is template so it can contains different types. So how I can create methods for all types that I foresee? I tried in this way:
template<typename type>
class DoublyLinkedList
{
public:
void DoublyLinkedList<int>::Sort(){}
void DoublyLinkedList<string>::Sort(){}
};
But it's wrong. Please help.