This preview shows page 1. Sign up to view the full content.
Unformatted text preview: * 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 cap; Object* Stack; int top; // Feel free to add whatever additional data or functions that you wish. }; #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