/** * Interface for a stack: A collection of objects that are inserted * and removed according to the last-in first-out principle. */ template <typename Object> class Stack { public: /** * Returns number of objects in the stack. */ int size() const; /** * Returns true if the stack is empty, false otherwise. */ bool isEmpty() const; /** * Returns the top object in the stack. * Throws StackEmptyException if the stack is empty. */ Object& top() throw(StackEmptyException); /** * Inserts an object at the top of the stack. */ void push(const Object& obj); /** * Removes and returns the top object from the stack. * Throws StackEmptyException if the stack is empty. */ Object pop() throw(StackEmptyException); };