Menu

Destructors in c++

  • Destructors a special member function, that takes the same name of the class name followed by the tilde(~).

Syntax

            ~classname();

Characteristics of Destructors

  • Destructors are the inverse of constructors.
  • It is automatically called when objects are destroyed.
  • It has the same name as that of the class followed by ~
  • It doesn't return any value.
  • It doesn't have any return type.