diff --git a/point.cpp b/point.cpp index 95c34d36..d281c826 100644 --- a/point.cpp +++ b/point.cpp @@ -43,3 +43,12 @@ point::manhattan (const point &other) const { return fabs (x - other.x) + fabs (y - other.y); } + + +point& +point::operator+= (const point &rhs) { + x += rhs.x; + y += rhs.y; + + return *this; +} diff --git a/point.hpp b/point.hpp index 12b2426b..00d018ec 100644 --- a/point.hpp +++ b/point.hpp @@ -29,6 +29,8 @@ namespace util { double distance (const point &) const; double manhattan (const point &) const; + + point& operator+= (const point&); }; }