#include using namespace std ; class Demo { public: int x1 ; int x2 ; int* ptr ; Demo() { cout << "Inside the construtor method." << endl ; ptr = new int[10] ; //Initialize with some values for( int i1=0; i1<10 ; i1++ ) { ptr[i1] = i1+ 1; } } Demo(const Demo& demoObj ) { cout << "Inside the copy construtor method." << endl ; ptr = new int[10] ; //Copy the values in the array from demoObj for( int i1=0; i1<10 ; i1++ ) { ptr[i1] = demoObj.ptr[i1] ; } } ~Demo() { cout << "Inside the destrutor method." << endl ; delete[] ptr ; } void print() { for( int i1=0; i1<10 ; i1++ ) { cout << ptr[i1] << " " ; } cout << endl ; } }; int main() { Demo demo1 ; Demo demo2 = demo1 ; demo2.print() ; }