void Interface::unsorted_interger_list()
{
bool isQuit = false;
while(!isQuit)
{
///I declare a List<int>* mylist in Interface.h file and call
///the funcions which belong to the class List.
mylist->print();///error: undefined reference to 'List<int>::print()'
///But I defined my funtion in Class:List.
///Why it doesn't work?
unsorted_list_menu();
int choice = reader.readInt(0, 10);
if(choice == 0)
{
isQuit = true;
}
elseif(choice == 1)
{
cleanstreen();
cout<<"Input value from front:\n";
int data = reader.readInt();
mylist->pushFront(data);
}
}
}
I found I could implement them outside the template class, provided they were still in the header file, but with large template headers it does get very messy.
Is the normal rule that functions implemented inside the class declaration are inline and those outside are non inline still applicable for template classes? (Assuming the compiler doesn't overrule your judgement...)