#include "Point.h" #include #include using std::cout; using std::endl; Point::Point() : x_(0), y_(0) { cout << "Calling default constructor" << endl; } Point::Point(int x, int y) : x_(x), y_(y) { cout << "Calling 2-arg constructor" << endl; } Point::Point(const Point ©me) { cout << "Calling copy constructor" << endl; x_ = copyme.x_; y_ = copyme.y_; } Point& Point::operator=(const Point &rhs) { cout << "Calling assignment operator" << endl; if (this != &rhs) { x_ = rhs.x_; y_ = rhs.y_; } return *this; } Point::~Point() { cout << "Calling destructor" << endl; } double Point::Distance(const Point &p) const { double distance = (x_ - p.x_) * (x_ - p.x_); distance += (y_ - p.y_) * (y_ - p.y_); return sqrt(distance); } void Point::SetLocation(int x, int y) { x_ = x; y_ = y; }