C++ Program using destructor

In this program, You will learn how to implement destructor in C++.

Destructor in C++

~Test( ) { }

Example: How to implement destructor in C++

Run it Now
using namespace std;

class Test {

    Test() {
       cout << "Constructor is called here";

   ~Test() {
       cout << "\nDestructor is called here";

int main() {

   Test tt;

   return 0;


Constructor is called here
Destructor is called here