0

I have started the program but I need help with createing a class which works for both integers and characters.

template< class T >

class List

{

  private:

                struct node

                {

                                T data;

                                node * next;

                } 

                node * head, * tail;

                int size;

  public:

                List();

                void Push_Head ( T item ); // inserts first

                void Push_Tail ( T item ); //inserts last

                T Head(); // returns the first node

                T Tail(); // returns the last node                 

                void Pop_Head(); //removes the first node

                void Pop_Tail(); //removes the last node

                int Length();

};

List<int> intList;

List<char> charList;
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Clockowl
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.