Skip to content

Instantly share code, notes, and snippets.

@towc
Created March 1, 2017 22:53
Show Gist options
  • Select an option

  • Save towc/93c9d8b0688da65c3105ba7097ba7e9a to your computer and use it in GitHub Desktop.

Select an option

Save towc/93c9d8b0688da65c3105ba7097ba7e9a to your computer and use it in GitHub Desktop.
#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 );
}
#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