template<class T, int size = 10> class Stack
Basic stack templete class
void main() { Stack<int, 100> s1; cout << "\nPush: "; for (int i = 1; !s1.full(); i++) { cout << i << ", "; s1.push( i ); } cout << "\nPop: "; for (i = 1; i <= 101; i++) cout << s1.pop() << ", "; }
Stack | Basic stack templete class |
Constructors | |
~Stack | Public destructor |
empty | Determine whether the stack is empty. |
full | Determine whether the stack is full. |
Stack | Public constructor |
Functions | |
pop | Pop a stack element |
push | Push a stack element |
Signal handlers | |
overflow | Stack overflow signal |
underflow | Stack underflow signal |
To send feedback on this topic email: natural@gmai l.com docsplus
© Some Rights Reserved. see <License>
Basic stack templete class
template<class T, int size = 10> class Stack
Public destructor
~Stack()
Determine whether the stack is empty.
int empty() const
Determine whether the stack is full.
int full() const
Public constructor
Stack()
Pop a stack element
template<class T, int size> T Stack<T, size> ::pop()
Push a stack element
template<class T, int size> void Stack<T, size> ::push( T item )
Stack overflow signal
template<class T, int size> void Stack<T, size> ::overflow()
Stack underflow signal
template<class T, int size> void Stack<T, size> ::underflow()