// 25_25-18.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>

using namespace std;

class ClsA {
private:
	int dt;
public:
	ClsA(int n) { dt = n; }
	void set(int n) { dt = n; }
	void disp_cn() const { cout << "dt=" << dt << '\n'; }	// const付き
};

int _tmain(int argc, _TCHAR* argv[])
{
	// 非constオブジェクトに対する通常の利用
	ClsA a(100);
	a.disp_cn();
	a.set(200);
	a.disp_cn();
	
	// constオブジェクトに対する利用
	const ClsA b(300);
	b.disp_cn();	// 利用できる
	//b.set(400);	// 利用できない

	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

