| A variant of Point with cached polar representation. | Lecture 3 - slide 23 : 36 Program 1 |
class Point {
private:
mutable bool is_polar_cached;
mutable 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&);