|
/****************************************************************************/
/* */
/* Copyright (C) 1998; IPL, Information Processing Ltd */
/* */
/****************************************************************************/
/* */
/* Cantata++ Demo - Unbounded Stack Header File */
/* */
/****************************************************************************/
class stack
{
public:
stack(); // create empty stack
stack(const stack&); // create copy of stack
~stack(); // destructor
bool is_empty(); // return true if stack is empty
void push(int); // push an integer onto the stack
int pop(); // pop the top integer from the stack
struct new_error {}; // exception if new cannot allocate memory
struct empty_pop {}; // exception if pop from an empty stack
private:
struct node // node to store data
{
int data;
node* next;
};
node* head; // head of stack pointer
};
|