blob: 8433e79b4c9b90c5a6218413cfb40415c024ace3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
class Vector
{
public:
int x;
int y;
Vector (int ex, int why) : x {ex}, y {why} {}
Vector () : x {0}, y{0} {}
Vector& operator+= (Vector v) { x += v.x, y += v.y; return *this; }
Vector& operator-= (Vector v) { x -= v.x, y -= v.y; return *this; }
Vector& operator*= (Vector v) { x *= v.x, y *= v.y; return *this; }
};
Vector operator+ (Vector, Vector);
Vector operator- (Vector, Vector);
Vector operator* (Vector, Vector);
|