// point.cc in which move is only present if C is a floating point type. #include #include #include "point.h" template Point::Point(C x_coord, C y_coord): x(x_coord), y(y_coord){ } template Point::Point(): x(0.0), y(0.0){ } template C Point::getx () const{ return x; } template C Point::gety () const{ return y; } // if C is not a floating point type, the move function is not present. template Enable_if::value, Point>& Point::move(C dx, C dy){ x += dx; y += dy; return *this; } template double Point::distance_to(Point p){ return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y)); // Similar assumptions for - and * } template std::ostream& operator<< (std::ostream& s, const Point& p){ return s << "(" << p.getx() << "," << p.gety() << ")" ; }