I have a linked list class (List) that deals only with objects of type Node. It can do all sorts of things with these Nodes assuming that they have boolean comparisons overloaded properly. The thing is, I want to use this List class with a special kind of Node called a Term (an algebraic term with a coefficient and an exponent or degree). How do I tell my List class to use the Term functions (Term has special versions of the Print() function and comparison operators) even though it deals with the Terms using Node pointers? For example, my Print() is something like:
Node* walker=head;
while(walker)
{
walker->Print();
walker=walker->next;
}
Except there is no Node::Print(), I want it to call Term::Print()! Do I have to make a whole new List class to deal with Term class objects?