#include using namespace std; class Package { private: int value; public: Package() { value = 7; cout << "Constructor:" << value << endl; } void print() { cout << "Inside print method:" << value << endl; } Package(int v) { value = v; cout << "Constructor:" << value << endl; } ~Package() { cout << "Destructor:" << value << endl; } }; int main() { Package* obj1 = new Package(4); Package* obj2 = new Package() ; Package* obj3 = new Package(3) ; obj1->print() ; (*obj1).print() ; //Setting the pointer to NULL will not destruct the object //Object destruction can only happen with delete. //obj1 = NULL ; // delete( obj1 ) ; //obj1 = NULL ; delete ( obj2 ) ; delete ( obj3 ) ; return 0; }