+ 2
if a class doesn't have a destructor defined, what happens when the object is destroyed?
5 ответов
+ 3
an object will still be removed from memory without a destructor. read about c#'s automatic garbage collection for more. You will rarely (if ever) write a destructor in practice
+ 2
the default destructor will work
0
Nothing. Destructor does not delete/destroy objects, but it executes commands defined in it when objects are deleted/destroyed.
0
yeah
- 2
i think then the class wont be destroyed. i assume the whole idea of destructor is ensure a contructor is completely cleared off after the program is done with it. look at it this, opening and closing a database. this would help to free up memory etc.