![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
StackP.hGo to the documentation of this file.00001 00017 #include "StackException.h" 00018 typedef desired-type-of-stack-item StackItemType; 00019 00021 class Stack 00022 { 00023 public: 00024 // Constructors and destructor: 00025 00027 Stack(); 00028 00031 Stack(const Stack& aStack); 00032 00034 ~Stack(); 00035 00036 // Stack operations: 00037 bool isEmpty() const; 00038 void push(const StackItemType& newItem) throw(StackException); 00039 void pop() throw(StackException); 00040 void pop(StackItemType& stackTop) throw(StackException); 00041 void getTop(StackItemType& stackTop) const 00042 throw(StackException); 00043 00044 private: 00046 struct StackNode 00047 { 00049 StackItemType item; 00051 StackNode *next; 00052 }; // end StackNode 00053 00055 StackNode *topPtr; 00056 }; // end Stack 00057 // End of header file. |