0

what is the destructor

30th Nov 2016, 8:34 PM
s.usni
2 ответов
+ 6
A destructor is a little similar to a constructor. A constructor will run code when an object is instantiated, but a destructor will run code when an object is destroyed. This happens when the scope of an object runs out. Ex: If you make an object in a method, and then leave the method, the destructor will trigger.
30th Nov 2016, 8:43 PM
Tamra
Tamra - avatar
+ 3
A destructor is a special method called automatically during the destruction of an object. Actions executed in the destructor include the following: Recovering the heap space allocated during the lifetime of an object. Closing file or database connections. Releasing network resources.
30th Nov 2016, 9:10 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar