//xxxcopy.cpp #include using namespace std; class Cat { int a; public: Cat(int x) { a = x; cout << " born " << a << endl;} friend ostream& operator<<(ostream&, const Cat&); /***/ Cat(const Cat& cc) { // copy constructor cout << " you give me " << cc.a << endl; a = 456; cout << " you give me " << cc.a << endl; cout << " ..copy constructor.. "; } /***********/ }; int main( ) { Cat x(123); Cat y = x; cout << "x=" << x << endl; cout << "y=" << y << endl; } ostream& operator<<(ostream& river, const Cat& aaa) { river << aaa.a; return river; }