/* This class specifies the basic operation on a stack as a linked list */ #ifndef DATA_STRUCTURES_STK_STACK_H_ #define DATA_STRUCTURES_STK_STACK_H_ /* Definition of the node */ template struct node { Type data; node *next; }; /* Definition of the stack class */ template class stack { public: void display(); /* Show stack */ stack(); /* Default constructor*/ ~stack(); /* Destructor */ bool isEmptyStack(); /* Determine whether the stack is empty */ void push(Type item); /* Add new item to the stack */ Type top(); /* Return the top element of the stack */ void pop(); /* Remove the top element of the stack */ void clear(); stack &operator=(const stack &otherStack); // Overload "=" the assignment operator. private: node *stackTop; /* Pointer to the stack */ int size; }; #endif // DATA_STRUCTURES_STK_STACK_H_