I was wondering, is it very useful to put destructors for classes? And what's the purpose of it?
Thanks :)
Printable View
I was wondering, is it very useful to put destructors for classes? And what's the purpose of it?
Thanks :)
To completely clear up the memory that was allocated for the instance of the class
If you use only auto variables(default) then destructor is not needed. Default constructor is created anyway. But dynamically allocated data should be destroyed.
Thanks :)
deconstuructors are called when a onject is destroyed
Got it :)