くだすれC++/CLI(初心者用)

このエントリーをはてなブックマークに追加
725デフォルトの名無しさん
別途インスタンス作成のための静的メンバ関数を設ければよい。
ref class Hoge
{
int m_hoge;
public: //時と場合によってprotected或いはprivate
Hoge(int hoge) : m_hoge(hoge) {}

public:
static Hoge^ CreateHoge(int hoge) {return gcnew Hoge(hoge);}
static Hoge^ CreateHoge() {return gcnew Hoge(1234);}
};