// Demo of deep copy, which defines the assignment operator only #include #include using namespace std; class myVec { public: myVec(int n){size=n; data=new int[size];}; myVec(){size=10; data=new int[size];}; ~myVec(){delete [] data;}; // myVec(const myVec& a); // copy constructor from a myVec& operator=(const myVec& a); // assignment operator from a 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(); return EXIT_SUCCESS; }