[   ^ to index...   |   <-- previous   |   next -->   ]

A list class

class LinkedList { public: LinkedList(); ~LinkedList(); // destructor needed bool isEmpty(); int length(); void insert(int position, Item item); Item delete(int position); Item get(int position); private: ListNode * head; };

Notice that there isn't anything profoundly different about this definition. The difference is simply that the language gives us direct support for the concept that was implicit in the C-style ADT.

Variations on the list


Last modified: Wed Jul 12 19:35:13 PDT 2000