I am relatively new to C ++ (and generally programming), so please forgive me if the question is not entirely clear right away.
I have a program in which a certain number of objects of the inner class are created [let call this "class1"]. The program works fine, and the objects do what they should.
The problem I'm trying to solve now is this: these objects are not destroyed (and therefore no memory is allocated) until the program exits, but I need this memory earlier.
Among other members of the class are objects of other internally defined classes (which also have members that are objects of the third class).
My question is the following: how to correctly determine the destructor for class 1 objects so that all data is canceled and memory freed?
I found out (perhaps it was already obvious to you) that the destructor is kind of
class1::~class1(void) { }
will not work (I defined similar destructors for all internally defined classes).
Reading around, I realized that my mistake may be that it is a destructor that does nothing. How to solve this?
Thanks to everyone who will answer / help / comment.
Federico
source share