// CS2 Chung, testing automatic assignment op. and copy constructor #include class Point { private: double x; double y; public: Point() { x = 0; y = 0; } Point(double init_x, double init_y) { x = init_x; y = init_y; } friend void operator >> (istream& ins, Point& target) { cout << "Enter x and y for a point: "; ins >> target.x >> target.y; } friend void operator << (ostream& outs, Point& source) { outs << "(" << source.x << ", "; outs << source.y << ")" << endl; } }; void main() { Point p1; cin >> p1; Point p2; cin >> p2; p1 = p2; // automatic assignment op, both existed before. cout << p1; cout << p2; Point p3(p2); // copy constructor, p3 is created and copied cout << p3; }