#include<iostream>
using namespace std;
class Complex
{
private:
int a,b;
public:
Complex() //Constructor (first function of object)
{ }
~Complex() //Destructor (last function of object)
{
cout << "Destuctor";
}
};
void fun()
{
Complex c1; //this object will get destroyed when fun function has completed its work.
}
int main()
{
fun();
}
It should be defined to release (or access) resources allocated to an object.