1.

Describe the importance of destructor. List some of the special properties of destructor.

Answer»

A object that is existing must be scrapped off when it is o more needed. The task of scrapping off an object is carried out by a destructor. A destructor deinitializes an object and deallocates all allocated resources. Properties of destructor:

  • Destructor functions are invoked automatically when the objects are destroyed. 
  • There can be only one destructor for a class, means destructor can’t be overloaded.
  • No argument can be provided to a destructor, neither does it returns any value.


Discussion

No Comment Found

Related InterviewSolutions