I am really new to C++. All my programming experience is in Java. I'm still learning about memory management. I'm trying to put together a BST. Everything works except that my clear method doesn't work yet. It is supposed to delete all the nodes of the tree. I also want it to free up the memory that the nodes used too. So the code I used was this:
When I call clear I pass the root of my tree into this deleteAll function. The problem is that my root node seems to still be there. It's not null or anything like I'd expect. Any thoughts?Code:
void BST::deleteAll(BSTNode* current)
Thanks for the help you guys!