+ 2

if a class doesn't have a destructor defined, what happens when the object is destroyed?

16th Apr 2016, 12:36 AM
Greg Mavhunga
Greg Mavhunga - avatar
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
24th Apr 2016, 1:52 AM
Eric Phillips
Eric Phillips - avatar
+ 2
the default destructor will work
15th Jun 2016, 3:19 AM
Sardor
Sardor - avatar
0
Nothing. Destructor does not delete/destroy objects, but it executes commands defined in it when objects are deleted/destroyed.
9th May 2016, 12:13 PM
Leszek Górniak
Leszek Górniak - avatar
0
yeah
10th Jun 2016, 11:04 PM
Saikat Jahan
Saikat Jahan - avatar
- 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.
18th Apr 2016, 5:18 AM
Lloyd Mwaluku
Lloyd Mwaluku - avatar