//-------------------------------------------------------------------- // // Laboratory 5, In-lab Exercise 2 stackdwn.h // // Class declaration for the array implementation of the Stack ADT // that grows from the end of the array downward toward the // beginning // //-------------------------------------------------------------------- const int defMaxStackSize = 10; // Default maximum stack size template < class DT > class Stack { public: // Constructor Stack ( int maxNumber = defMaxStackSize ) throw ( bad_alloc ); // Destructor ~Stack (); // Stack manipulation operations void push ( const DT &newDataItem ) // Push data item throw ( logic_error ); DT pop () // Pop data item throw ( logic_error ); void clear (); // Clear stack // Stack status operations bool isEmpty () const; // Stack is empty bool isFull () const; // Stack is full // Output the stack structure -- used in testing/debugging void showStructure () const; private: // Data members int maxSize, // Maximum number of data items in the stack top; // Index of the top data item DT *dataItems; // Array containing the stack data items };