#ifndef __StackAr #define __StackAr #include #include //#include "AbsStack.h" #include "vector.h" // modifed Weiss array stack by Owen Astrachan // 9/6/95, to incorporate CPS 6/100 Vector class instead // of arrays. Also removed dependence on AbsStack class // 9/21/95 -- renamed private fields in myFoo style template class Stack // : public AbsStack { public: Stack( ); // construct empty stack ~Stack( ); // destructor const Stack & operator=( const Stack & Rhs ); // assign Rhs to self void Push( const Etype & X ); // push X onto top of stack void Pop( ); // pop top element const Etype & Top( ) const; // return top element (NO pop) bool IsEmpty( ) const; // return true if empty, else false void MakeEmpty( ); // empty stack (no elements) int NumPushes(); // returns # of elements pushed int Size(); // returns # of elements in stack private: // Copy constructor is OK (contrast Weiss) int myMaxSize; int myTop; int myPushes; Vector myArray; }; #endif