Revise the destructor in the class LinkedBagso that it does not call clear,butinstead directly deletes each node of the underlying linked chain.
What will be an ideal response?
```
template
LinkedBag
{
while (headPtr != nullptr)
{
Node
headPtr = headPtr->getNext();
// Return node to the system
nodeToDeletePtr->setNext(nullptr);
delete nodeToDeletePtr;
} // end while
// headPtr is nullptr
nodeToDeletePtr = nullptr;
itemCount = 0;
} // end destructor
```
You might also like to view...
What Windows components are kept in the WOW6432NODE folder?
A) 32-bit registry keys B) 32- and 64-bit device drivers C) 32- and 64-bit Windows file D) 32- and 64-bit Windows networking commands
Which is not an illusion of physical movement among screens?
A) scrolling B) context-sensitive pop-up windows C) onscreen dialogue D) None of the above.