This preview shows page 1. Sign up to view the full content.
Unformatted text preview: /** Returns a const reference to the top object in the stack. * Throws a runtime_error if the stack is empty. * @return reference to top element */ const std::string& top() const; /** Inserts an object at the top of the stack. If the stack * is already at capacity, the oldest element will be lost. * @param the new element */ void push(const std::string& elem); /** Removes the top object from the stack. * Throws a runtime_error if the stack is empty. */ void pop(); private: int capacity; string* S; int tp; }; #endif...
View Full Document
This note was uploaded on 05/03/2011 for the course CSCI 180 taught by Professor Goldwasser,m during the Fall '08 term at Saint Louis.
- Fall '08
- Data Structures