This is just an idle thought I had when reading this other question:
What is the correct way to delete char**
If the chars mentioned in that question had been created inside an object and that object was deleted, would that correctly clean up the pointers as well, or would they be stuck in memory?
If you delete an object, the destructor for that object will be called, so you need to do a delete in the destructor. So remember, everything that the class has allocated on the heap has to be freed in the destructor. If it was been allocated on the stack this happens automatically
But be careful, if you are using inheritance, if
Ainherits from a base class, you need to make the base destructor virtual, or else the destructor inAwill not be called and you will have a memory leak.