Revise the destructor in the class LinkedListso that it directly deletes eachnode of the underlying linked chain without calling either clearor remove.

What will be an ideal response?


```
template
LinkedList::~LinkedList()
{
while (headPtr != nullptr)
{
Node* nodeToDeletePtr = headPtr;
headPtr = headPtr->getNext();
// Return node to the system
nodeToDeletePtr->setNext(nullptr);
delete nodeToDeletePtr;
} // end while
// headPtr is nullptr
nodeToDeletePtr = nullptr;
itemCount = 0;
} // end destructor

```

Computer Science & Information Technology

You might also like to view...

You click commands on the Document bar to handle document tasks.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

If a given task being performed by a function involves more than one object, then that function should normally be a __________ function.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which of the following is an interagency body empowered to prescribe uniform principles, standards, and report forms for the federal examination of financial institutions?

A) NCUA B) FRB C) FDIC D) FFIEC

Computer Science & Information Technology

Powerpoint sucks?

Computer Science & Information Technology