2. What is destructor?
A destructor is a special member function that is
called when the lifetime of an object ends.
The purpose of the destructor is to free the resources
that the object may have acquired during its lifetime.
3. DEFINITION OF DESTRUCTOR:
A Destructor is used to destroy the objects
that have been created by constructor.
Like a constructor the destructor is a
member function whose name is the same
as the class name but is preceded by a
tilde.
4. FOR EXAMPLE:
The destructor for the class integer can be
Tell in or defined in
~integer(){}
• We define the destructor by the symbol
“TILDE”(~).
5. A Destructor never takes any arguments
nor does it return any value
Destructor are mainly used for in future
use for memory space.
6. • Implicitly by the complier exit from the
program to clean up storage that is for no
longer accessible.
• In constructor allocate the memory by
using “new” and “delete” used to delete
memory.
8. A Destructor is not called implicitly.
Destructor mainly used for destroy the
object.
9. Destructor in c++:
A destructor is called for a class object when that
object passes out of scope or is explicitly deleted
It is mainly used for deallocate memory and clean up
the class object and its class members.
10. C++
A destructor is a special method called automatically
during the destruction of an object.
Actions executed in the destructor include the following:
Recovering the heap space allocated during the lifetime of
an object.
Closing file or database connections.
Releasing network resources.
11. Overload destructor
Destructor is mainly used to delete the object
and so only one time to call destructor when the
overloading is not occur
Destructor it needs to call when you destroy an
object