Why is my destructor not working properly when ran with my whole code it keeps displaying 01010101010101 etc here is my code
LinkedList::~LinkedList()
{
NodePointer ptr = first;
while(ptr != 0){
first = ptr->next;
delete ptr;
ptr = first;
}
if (first == 0) cout << "List destroyed\n";
else cout << "List not destroyed\n";
}