class ExpStack
{
private:
struct node
{
Exp_Obj *data;
node *next;
};
node *head;
public:
ExpStack( void ) { head=NULL; };
~ExpStack( void )
{
node *temp;
while (head!=NULL)
{ temp=head; head=head->next; delete temp; }
}
void Push(Exp_Obj *obj)
{
node *temp=new node;
temp->data=obj; temp->next=head;
head=temp;
};
Exp_Obj *Pop( void )
{
if (head==NULL)
{
cout << "Stack Underflow...\n";
exit(1);
}
node *temp=head;
head=head->next;
Exp_Obj *tempData=temp->data;
delete temp;
return tempData;
};
int Empty( void ) { if (head==NULL) return 1; else return 0; }
};
/* End of File */