I'm trying to write a destructor that will run through the linked list of children of the current node being destroyed and delete all of them (which should recursively call their destructors as well)
Instead the program just crashes.
The other issue is that this if I uncomment the code in RemoveAndDeleteAllWidgets, and try to manually call the destructor, I get an error saying 'no match for 'operator~' in '~Widget()'
This last error is making me suspect that my compiler might be buggy and have issues dealing with destructors.
~Widget()
{
cout << "children of node with value " << x << " being deleted" << endl;
Node*sentinel = new Node;
sentinel = list;
cout << sentinel->data->x << "*" << endl;
while (sentinel != NULL)
{
sentinel = sentinel->next;
delete sentinel->prev;
}
}
void RemoveAndDeleteAllWidgets()
{
//~Widget();
}