const-members/situation-1/point.h - A variant of Point with cached polar representation. | Lecture 4 - slide 26 : 40 Program 1 |
class Point { private: bool is_polar_cached; double r, a; // Cached polar representation of point. double x, y; void do_polar_caching() const; public: Point(double, double); Point(); double getx () const; double gety () const; double getr () const; double geta () const; void move(double, double); double distance_to(Point) const; }; std::ostream& operator<<(std::ostream&, const Point&);