when creating objects of a class is there any need to include a user defined destructor to destroy them or am I better of with the default one ie. is there any need for a desructor when it just deals with objects.
thanks.
This is a discussion on destructor (any need) within the C++ Programming forums, part of the General Programming Boards category; when creating objects of a class is there any need to include a user defined destructor to destroy them or ...
when creating objects of a class is there any need to include a user defined destructor to destroy them or am I better of with the default one ie. is there any need for a desructor when it just deals with objects.
thanks.
Well if you have allocated memory on the freestore with new....then where better to call delete on the pointer before you lose scope..
If you dont you will have memory leaks...
If it is a simple class where all variables are on the stack then you could get away with it