diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index fe2c2ae..b8ea10f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,11 +45,31 @@ struct Point { int x, y; - bool operator==(const struct Point &p) const + bool operator==(const Point &p) const { return x == p.x && y == p.y; } + Point operator+(const Point &p) const + { + return {x + p.x, y + p.y}; + } + + Point operator-(const Point &p) const + { + return {x - p.x, y - p.y}; + } + + Point operator*(const Point &p) const + { + return {x * p.x, y * p.y}; + } + + Point operator*(int m) const + { + return {x * m, y * m}; + } + Point() : x{0}, y{0} {} |