// 25_25-2.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>

using namespace std;

class Csmp1 {
private:
	int x;
public:
	Csmp1(int n);
	void disp() {
		cout << "x=" << x << '\n';
	}
};

Csmp1::Csmp1(int n)
{
	x = n;
}

int _tmain(int argc, _TCHAR* argv[])
{
	//Csmp1 dt;	// コンストラクタが引数ありタイプなのでこれはエラー
	Csmp1 d1(100);	// 標準的な初期値設定
	Csmp1 d2 = 200;	// 引数が1個のときは代入形式初期化ができる
	Csmp1 d3 = Csmp1(300);	// コンストラクタを明示的に呼んでも良い

	d1.disp();
	d2.disp();
	d3.disp();

	d3 = Csmp1(400);	// 初期化ではないが、このような利用も可能
	d3.disp();

	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

