+ 3

what is a destructor ? can it be overload ?

this related to Java and c++ language - what's the answer of this question

11th Jan 2017, 5:18 AM
omkar patil
omkar patil - avatar
2 odpowiedzi
+ 3
A destructor is opposite of constructor. It is used to empty or delete the memory occupied my variables. Its main use is to prevent memory wastage. And destructor cannot be overloaded.
11th Jan 2017, 8:59 AM
Divesh Agarwal
Divesh Agarwal - avatar
+ 1
In Java there are no destructors, because you do not handle memory yourself. Cleanup is done by the garbage collector.
11th Jan 2017, 11:29 PM
1of3
1of3 - avatar