1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Declaring the public interface
for a linked list Istack
(Stacks/mydefs2.h)

class Istack {
class node {
public:
int data;
node* next;
};
node* new_node (int d, node* n);
node* top;
public:
// Note these are only prototypes
void init (int Nitems = 100);
void push (int x);
int pop ();
bool isempty();
bool isfull();
};

*

The public part of the interface looks the same as for the array version. Good information hiding.

Rewrite main(Stack/stackmain2.cc)

16-Mar-98

Page 1

C201/TAM/AGS