Explain the concept of destructor?
A destructor is a special method for a class and is requested automatically when an object is finally destroyed. The name of the destructor is also similar as that of the class but is followed by a prefix tilde (~).
A destructor is used to free the dynamic allocated memory and release the resources. You can, though, implement a custom method that permits you to control object destruction by calling the destructor.
The main features of a destructor are as follows:
a) Destructors do not have any return type
b) Similar to constructors, destructors are also always public
c) Destructors cannot be overloaded.