Each of the following member functions has errors in the way it performs a linked list operation. Find as many mistakes as you can.
NumberList::~NumberList()
{
ListNode *nodePtr, *nextNode;
nodePtr = head;
while (nodePtr != nullptr)
{
nextNode = nodePtr–>next;
nodePtr–>next = nullptr;
nodePtr = nextNode;
}
}