i came into Assertion failure during running this program, and i really don't know why, hope you guys can help, thanks a lot ^^

The program is to copy a linked list from another, the Copy function may look complicated because i'm not experienced enough to simplify it.. Without the destructor, the program runs fine..

``````#include <iostream.h>

struct node
{
int data ;
node * next ;
};

class list
{
private:
public:
list() ;
[B]//~list() ;[/B]
node* Add(node *h , int d) ;
node* Copy(node *& res , node * copy) ;
void Input() ;
void Display() ;
};

list::list()
{
}

[B]/*list::~list()
{
{
}
}*/[/B]

{
}

{
}

node * list::Add(node *h , int d)
{
if ( !h )
{
h = new node ;
h->data = d ;
h->next = NULL ;
}
else
h->next = Add(h->next , d) ;
return h ;
}

void list::Input()
{
int n ;
int d ;
cout << "How many intergers to input: " ;
cin >> n ;

for ( int i = 0 ; i < n ; ++i )
{
cout << "Interger #" << i+1 << ", please enter: " ;
cin >> d ;
}
}

void list::Display()
{
node * current = head ;
while (current != NULL)
{
cout << current->data << " " ;
current = current->next ;
}

}

node * list::Copy(node *& res , node * copy)
{

if (copy)
{
res = copy ;
Copy(res->next,copy->next) ;
}

return res ;
}

int main()
{
list integer , a ;

integer.Input() ;

integer.Display() ;
cout << endl ;

//a.Input() ;

//a.Display() ;

node *res = NULL ;

a.Display() ;

return 0 ;
}``````

you need only:

``````list::~list() {