A Template Version of List Class

can be like this:

template <class T> class List;

template <class W>
class Node {
        friend class List<W>;
                W data;
                Node *next;
                Node(const W &data);
                Node(const W &data, Node *nxt);
                Node &operator=(const Node &n);
                virtual ~Node();

template <class T>
class List {
        int count;
        int out_of_memory;
        Node<T> *head;
        void Copy(const List &lst);
        void initList();
        void deInitList();
        List(const List &lst);
        List(const T &data);
        virtual ~List();
        List &operator=(const List &lst);
        bool isEmpty();
        bool isFull();
        int deleteFromHead(T &t);
        int deleteFromList(const T &t);
        int add(const T &t);
        int addToTail(const T &t);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s