// A variant of point.cc where we use this more than usual. #include #include #include "point.h" Point::Point(double x_coord, double y_coord): x(x_coord), y(y_coord){ } Point::Point(): x(0.0), y(0.0){ } double Point::getx () const{ return this->x; } double Point::gety () const{ return this->y; } Point* Point::move(double dx, double dy){ this->x += dx; this->y += dy; return this; } double Point::distance_to(Point p){ return sqrt((this->x - p.x) * (this->x - p.x) + (this->y - p.y) * (this->y - p.y)); } std::ostream& operator<<(std::ostream& s, const Point& p){ return s << "(" << p.getx() << "," << p.gety() << ")" ; }