CS210 Lab: Templates--Linked List for Integer


The following is the class definition for a linked list of integers. This will be placed in a ".h" file. The member functions will be defined in a separate ".cpp" file (not included here):
class LinkedList;

class ListElement
    int datum;
    ListElement* next;
    ListElement (int const&, ListElement*);

    friend LinkedList;

class LinkedList
    ListElement* head;
    LinkedList ();
    ~LinkedList ();
    bool IsEmpty () const;
    int const& First () const;
    int const& Last () const;
    void Prepend (int const&);
    void Append (int const&);
    void Extract (int const&);
    void Print ();

Back to Templates Lab click here

CS Dept Home Page
CS Dept Class Files
CS210 Class Files

Copyright: Department of Computer Science, University of Regina.