class MyClass
{ int value;public: MyClass(int i=10) { value = i; cout << "Constructor called." << endl; } MyClass( MyClass& p) { p.value = 11; value = p.value; cout << "Copy constructor called" << endl; } void Print() { cout << "The Value is " << value << endl; } ~MyClass(){ cout << "Destructor called" << endl; }};int main()
{ MyClass obj1; obj1.Print(); MyClass obj2(obj1); obj2.Print(); return 0;}