Step-by-step instructions for "templatizing" your classes:
  1. Add the tag " template < class T > " just before the class declaration
    For example:
    
    ...
    class ListItem{
    ...
    
    becomes
    
    ...
    template < class T >
    class ListItem{
    ...
    
    
  2. Change the templated type variables to T
    For example:
    
    ...
    int getVal() const;
    ...
    
    becomes
    
    ...
    T getVal() const;
    ...
    
    
  3. Change the pointers and references to objects of the templated class to reflect that they're now templated.
    For example:
    
    ...
    ListItem *temp;
    ...
    
    becomes
    
    ...
    ListItem<T> *temp;
    ...
    
    
  4. Friend classes that deal with the templated type must also become templated. However, using the same variable name as for the templated class will cause a conflict.
    Thus, a declaration such as:
    
    ...
    friend ostream &operator<<(ostream &, const List&);
    ...
    
    becomes
    
    ...
    template <class X> friend ostream &operator<<(ostream &, const Node<X>&);
    ...
    
    
  5. Add "template < class T >" before every class method.
  6. Change the name of the class in all method implementations to be List < T >, for example.
  7. Add the statement #include "whatever.C" at the end of the include file.
  8. The main program that uses the templated class should include whatever.h.
  9. The makefile should NOT attempt to "compile in" the templated class. The include file in the main program handles this.