C++でプロパティ作成

// プロパティのゲッターセッター変数定義を行う
// Property(プロパティ名, 型, 変数名)
#define Property(Name, Type, Variable) \
private: \
	Type Variable; \
public: \
	Type Get##Name(){ return Variable; } \
	void Set##Name(Type value){ Variable = value; }//\
	//_declspec(property(get = Get##Name, put = Set##Name)) Type Name;


class TestClass
{
public:
	Property(Hoge, int, m_value);
};

int main()
{
	TestClass ts;
	ts.SetHoge(100);
	printf("hoge = %d\n", ts.GetHoge());
	return 0;
}





コメント部分を元に戻せば、C#のプロパティみたいな感じに出来ます。