// 26_26-9.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>

using namespace std;

class XYpos {
private:
	int x, y;
public:
	XYpos(int n1 = 0, int n2 = 0) { x = n1; y = n2; }
	void disp() { cout << "(" << x << "," << y << ")\n"; }
	XYpos &operator+=(XYpos ob2);	// +=演算子
};

XYpos &XYpos::operator +=(XYpos ob2)
{
	x += ob2.x;
	y += ob2.y;
	return *this;
}

int _tmain(int argc, _TCHAR* argv[])
{
	XYpos d1(100, 200), d2(100, 200), d3(10, 20), d4(1,2);

	d1 += d3;
	d1.disp();
	d3.disp();
	d2 += d3 += d4;
	d2.disp();
	d3.disp();
	d4.disp();
	
	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

