1
// Template Stack class
definition derived from class List.
2
#ifndef STACK_H
3
#define STACK_H
4
5
#include
"List.h" // List class definition
6
7
template< typename
STACKTYPE >
8
class Stack : private
List< STACKTYPE >
9
{
10
public:
11
// push calls the List function
insertAtFront
12
void push( const STACKTYPE &data )
13
{
14
insertAtFront( data );
15
} // end function push
16
17
// pop calls the List function removeFromFront
18
bool pop( STACKTYPE &data )
19
{
20
return removeFromFront( data );
21
} // end function pop
22
23
// isStackEmpty calls the List function
isEmpty
24
bool isStackEmpty() const
25
{
26
return isEmpty();
27
} // end function isStackEmpty
28
29
// printStack calls the List function print
30
void printStack() const
31
{
32
print();
33
} // end function print
34
}; // end class Stack
35
36
#endif