does anyone know whats wrong with this ?? it keeps giving me an "Assertion Failed" _BLOCK_TYPE_IS_VAILD(pHead->nBlockUse) when it tries to use the detructor on a non empty stack EDIT:MORE CODES:
class stack
{
private:
   struct StackNode
   {
      int x;
      int y;
      StackNode *next;  
   };
   StackNode *top;     
public:
   stack()
      {  top = NULL; }
   ~stack();
 stack::~stack()
    {
        StackNode *nodePtr,*nextNode;
            nodePtr=top;
            while (nodePtr!=NULL) 
            { 
                nextNode=nodePtr->next;
                delete nodePtr;
                nodePtr=nextNode;
            }   
    }
main.cpp
mouse_position.push(mouse_x,mouse_y);
print_stack(mouse_position);
void print_stack(stack m)
{
    int tempx=0;
    int tempy=0;
//  while(!m.isEmpty()){
//      m.pop(tempx,tempy);
    cout<<tempx<<tempy<<endl;
//  }
}
 
     
     
     
    