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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.