I was wonder if any problems might come up from using recursion in a properly coded deconstructor for a single linked list.
ListData has it's own deconstructor that deletes whatever it needs to. Testing it with a cout seems to show it being called the correct number of times. Also, should I set pNextNode to NULL inside the deconstructor?Code:class MyList { ListData* pListData; MyList* pNextNode; } MyList::~MyList() { if (pListData) delete pListData; if (pNextNode) delete pNextNode; }



LinkBack URL
About LinkBacks



CornedBee