// Sample use of Point operator - // completely identical to the situation where the operators were defined as members in class Point. #include #include "point.h" using namespace std; int main(){ Point p(1,2), q(3,4), r(10,12); cout << "Point p: " << p << endl; // (1,2) cout << "Point q: " << q << endl; // (3,4) cout << "Point r: " << r << endl; // (10,12) cout << "Point q and q are" << ((p==q) ? "" : " not") << " equal" << endl; // equal cout << "Point p and r are" << ((p==r) ? "" : " not") << " equal" << endl; // NOT equal p++; q++; cout << "After p++: Point p: " << p << endl; // (2,3) cout << "After q++: Point q: " << q << endl; // (4,5) const Point &t = p + q; cout << "Point t = p + q: " << t << endl; // (6,8) }