// Demo of shallow copy, with double deletions #include #include using namespace std; class myVec { public: myVec(int n=10){size=n; data=new int[size];}; ~myVec(){delete [] data;}; void print(); // Print data int *data; int size; }; void myVec::print(){ cout << "["; for (int i=0; i" << endl; cout << "a: "; a.print(); cout << "b: "; b.print(); b.data[1]=4; cout << "b.data[1]=4 ==>" << endl; cout << "a: "; a.print(); cout << "b: "; b.print(); cout << "Last line of code..." << endl; return EXIT_SUCCESS; }