function-overloading/point.h - Point.h. | Lecture 3 - slide 9 : 27 Program 5 |
// Now overloading examples with class Point. // Class point with a constructor of type double, and a conversion from Point to double. class Point { private: double x, y; public: Point(double d); // Convert a double to a Point (via Point constructor) operator double() const; // Convert a Point to a double (via conversion operator) double getx () const; double gety () const; }; std::ostream& operator<<(std::ostream&, const Point&);