#ifndef LEAKY_STACK_B_H #define LEAKY_STACK_B_H #include #include "LeakyStack.h" using std::string; class LeakyStackB : public LeakyStack { enum { DEF_CAPACITY = 10 }; // default stack capacity public: /** * Constructor with specified max capacity * \param the maximum capacity (default: 10) */ LeakyStackB(int cap=DEF_CAPACITY); /** * Return the number of objects in the stack. * \return number of elements */ int size() const; /** * Determine if the stack is currently empty. * \return true if empty, false otherwise. */ bool empty() const; /** * Return a const reference to the top object in the stack. * \return const reference to top element * \throw runtime_error if the stack is empty */ const std::string& top() const; /** * Insert 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& e); /** * Remove the top object from the stack. * \throw runtime_error if the stack is empty. */ void pop(); private: // Feel free to add whatever additional data or functions that you wish. }; #endif