Created
March 1, 2017 22:53
-
-
Save towc/93c9d8b0688da65c3105ba7097ba7e9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Coordinate.h" | |
| Coordinate::Coordinate(){ | |
| this->x = 0; | |
| this->y = 0; | |
| } | |
| Coordinate::Coordinate( int x, int y ){ | |
| this->x = x; | |
| this->y = y; | |
| } | |
| Coordinate& Coordinate::operator += ( const Coordinate& b ){ | |
| return *this; | |
| } | |
| Coordinate& Coordinate::operator /= ( const int& b ){ | |
| return *this; | |
| } | |
| inline Coordinate operator + ( Coordinate a, const Coordinate& b ){ | |
| return Coordinate( a.x + b.x, a.y + b.y ); | |
| } | |
| inline Coordinate operator / ( Coordinate a, const int& b ){ | |
| return Coordinate( a.x / b, a.y / b ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef Coordinate_H | |
| #define Coordinate_H | |
| struct Coordinate { | |
| Coordinate(); | |
| Coordinate( int x, int y ); | |
| Coordinate& operator += ( const Coordinate& b ); | |
| Coordinate& operator /= ( const int& b ); | |
| int x, y; | |
| }; | |
| inline Coordinate operator + ( Coordinate a, const Coordinate& b ); | |
| inline Coordinate operator / ( Coordinate a, const int& b ); | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment