-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathStack.h
More file actions
29 lines (23 loc) · 844 Bytes
/
Stack.h
File metadata and controls
29 lines (23 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//Stack abstract class
template <typename E> class Stack
{
private:
void operator =(const Stack&) {} //protect assignment
Stack(const Stack&) {} //protect copy constructor
public:
Stack() {} //constructor
virtual ~Stack() {} //destructor
//reinitialize the stack. The user is responsible for
//reclaiming the storage used by the stack elements
virtual void clear() =0;
//push an element onto the top of the stack
//it: the element being pushed onto the stack
virtualvoid push(const E& it) =0;
//remove the element at the top of the stack
//return the element at the top of the stack
virtual E pop() =0;
//return A copy of the top element
virtual const E& topValue() const =0;
//return the number of elements in the stack
virtual int length() const =0;
};