/* * File: list.h * Author: Robert I. Pitts * Last Modified: Fall 2000 * Topic: Templates * ----------------------------------------------------- * * This is the interface for an linked list class. * Currently, the linked list can only hold integers. * */ #ifndef _LIST_H #define _LIST_H /* * While there are various insertion and removal operations we * could choose to provide, we provide only insertAtBeginning() * and removeFromEnd(). */ template class List { public: List(); ~List(); void insertAtBeginning(Item item); Item removeFromEnd(); bool isempty() const; private: // Each element of the list is held in a Node. class Node { // A "class within a class"? Yes, we can do that! public: Item item; Node *next; }; // Keep track of beginning (i.e., first node) in list. Node *head; }; #include "list.tem" #endif /* not defined _LIST_H */