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