diff options
Diffstat (limited to 'XY.cpp')
-rw-r--r-- | XY.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#include "XY.h" + +XY XY::operator - () const { + return XY { + .x = -x, + .y = -y, + }; +} + +XY XY::operator + (const XY & rhs) const { + return XY { + .x = x + rhs.x, + .y = y + rhs.y, + }; +} + +XY XY::operator - (const XY & rhs) const { + return XY { + .x = x - rhs.x, + .y = y - rhs.y, + }; +} + +XY& XY::operator += (const XY & rhs) { + this->x += rhs.x; + this->y += rhs.y; + return *this; +} + +XY& XY::operator -= (const XY & rhs) { + this->x -= rhs.x; + this->y -= rhs.y; + return *this; +} + |