What are Destructors?

 Posted by Bharathi Cherukuri on 2/22/2012 | Category: C# Interview questions | Views: 2014 | Points: 40

Destructors are used to destruct instances of classes.
Destructors cannot be defined in structures, they are only used with classes.
A class can only have one destructor.
Destructors cannot be inherited or overloaded.
Destructors cannot be called, they are invoked automatically.
A destructor does not take modifiers or have parameters.


class Car

~ Car() // destructor
// cleanup statements...

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response