![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
StackA.hGo to the documentation of this file.00001 00017 #include "StackException.h" 00018 const int MAX_STACK = maximum-size-of-stack; 00019 typedef desired-type-of-stack-item StackItemType; 00020 00023 class Stack 00024 { 00025 public: 00026 // constructors and destructor: 00028 Stack(); 00029 // copy constructor and destructor are 00030 // supplied by the compiler 00031 00032 // stack operations: 00038 bool isEmpty() const; 00039 00047 void push(const StackItemType& newItem) throw(StackException); 00048 00055 void pop() throw(StackException); 00056 00064 void pop(StackItemType& stackTop) throw(StackException); 00065 00073 void getTop(StackItemType& stackTop) const 00074 throw(StackException); 00075 00076 private: 00078 StackItemType items[MAX_STACK]; 00080 int top; 00081 }; // end Stack 00082 // End of header file. |