#include <iostream>
using namespace std;
class coord {
int x, y;
public:
coord() : x(0), y(0) {}
coord(int i, int j) : x(i), y(j) {}
void show() { cout << "x = " << x << ", y = " << y << endl; }
coord operator+(coord position);
coord add(coord position);
};
coord coord::operator+(coord position)
{
coord temp;
temp.x = this->x + position.x;
temp.y = this->y + position.y;
return temp;
}
coord coord::add(coord position)
{
coord temp;
temp.x = this->x + position.x;
temp.y = this->y + position.y;
return temp;
}
int main()
{
coord position_a(10, 10), position_b(5, 3);
coord position_m = position_a + position_b;
position_m.show(); // => x = 15, y = 13
coord position_n = position_a.add(position_b);
position_n.show(); // => x = 15, y = 13
return 0;
}