#include using namespace std; class FooT { public: FooT(char n) { name = n; cout << "\tIn the constructor for " << name << endl; } ~FooT() { cout << "\tIn the Destructor for " << name << endl; } char Name() { return name; } char name; }; void Fun1(FooT * param) { FooT * b; b = param; delete b; return; } int main() { cout << "Before declaring pointers" << endl; FooT * single = nullptr, *ary= nullptr; cout << "After declaring pointers" << endl; FooT instance('a'); cout << "The address of instance is " << & instance << endl; cout << endl; cout << "The name stored in instance is " << instance.Name() << endl; cout << "After declaring instance" << endl; cout << "Allocating a single " << endl; single = new FooT('b'); cout << "Single is " << single << endl; cout << "The name stored in single is " << single->name << endl; cout << "The name stored in single is " << single->Name() << endl; cout << "Delete single " << endl; delete single; single = nullptr; cout << "Allocating the array" << endl; ary = new FooT[4]{'c','d','e','f'}; cout << "Deleting the array" << endl; delete [] ary; cout << endl << endl << "calling fun1" << endl; single = new FooT('x'); Fun1(single); cout << "Deleting single " << endl; delete single; cout << "Exiting the program" << endl; return 0; }