#include using namespace std; template class Stack : public stack { public: /* --- Add a value to the stack if there is room--- * * Receive: The BoundedStack containing this function * (implicitly) * A value to be added to a BoundedStack * Pass back: The BoundedStack (implicitly), with value * added at its top, provided there is room * Output: Overflow message if no room for value **************************************************************/ virtual void push(const ElementType & value); /* --- Add several copies of a value to the stack if there is room--- * * Receive: The BoundedStack containing this function * (implicitly) * A value to be added to a BoundedStack, and * number of times value is to be added * Pass back: The BoundedStack (implicitly), with value added * number times at its top, provided there is room * Output: Overflow message if no room for value **************************************************************/ void RepeatedPush(const ElementType & value, int number); }; // Definition of push() template inline void Stack:: push(const ElementType & value) { stack::push(value); } // Definition of RepeatedPush() template inline void Stack:: RepeatedPush(const ElementType & value, int number) { for (int i = 1; i <= number; i++) push(value); }