Describe the term destructor

Briefly describe the term destructor?

E

Expert

Verified

Destructor is a special method for the class and is called up automatically when the object is finally destroyed. Name of a destructor is also same as that of a class but it is followed by the prefix tilde (~).

Destructor is used to release the resources and free the dynamic allocated memory. We can, though, implement the custom method which allows us to control object destruction through calling the destructor.
The main features of a destructor are as follows:

i. They do not have any return type.
ii. They are similar to constructors, as they are also always public
iii. They cannot be overloaded.

   Related Questions in DOT NET Programming

©TutorsGlobe All rights reserved 2022-2023.