// 26_26-1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>

using namespace std;

class XYpos {
private:
	int x, y;
public:
	XYpos(int a = 0, int b = 0) { x = a; y = b; }
	void disp() { cout << "(" << x << "," << y << ")\n"; }
	XYpos operator+(XYpos ob2);	// 演算子(+)の多重定義宣言
};

// +演算子のメンバ関数による多重定義
XYpos XYpos::operator +(XYpos ob2)
{
	XYpos wk;
	wk.x = x + ob2.x;
	wk.y = y + ob2.y;
	return wk;
}

int _tmain(int argc, _TCHAR* argv[])
{
	XYpos d1(100, 200), d2(30, 40), d3;

	d3 = d1 + d2;
	d1.disp();
	d2.disp();
	d3.disp();
	
	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

