#include "itemtype.h" // typedef for ItemType #ifndef NULL // If NULL is not yet defined #define NULL 0 // define it #endif // The bool's that are returned by the methods take value 1 if the // method succeeds and 0 otherwise (if there is overflow, underflow, etc.) struct StackNode { ItemType item; StackNode * next; StackNode(); StackNode(ItemType newitem, StackNode * newnext); }; class Stack { public: Stack(); ~Stack(); bool Init(); //(re-)Initializes the stack by emptying it bool IsEmpty(); //tests if stack is empty bool IsFull(); //tests if stack is full bool Push(ItemType item); //pushes ItemType onto stack bool Pop(ItemType & item); //pops stack and sets ItemType to popped value private: StackNode * list; //the linked list of items };