previous | start | next

## Implementing Linked Lists (The Classes for Lists, Nodes, and Iterators)

- The list object holds the locations of the first and last nodes in the list.

  >     class List
  >     {
  >     public:
  >        List();
  >        void push_back(string s);
  >        void insert(Iterator pos, string s);
  >        Iterator erase(Iterator pos);
  >        Iterator begin();
  >        Iterator end();
  >     private:
  >        Node* first;
  >        Node* last;
  >     };

- When the list is empty the first and last pointers are `NULL`.
- A list object stores no data; it just knows where to find the node objects that store the list contents.

previous | start | next