基本的なクラスの作成方法。
ヘッダーファイル(*.h)
#pragma once
#include "**.h" // 他にもヘッダーファイルを読み込む場合。
using namespace System;
namespace NameSpace //名前空間の設定
{
public __gc class Class //クラス名
{
private:
intm_int;
intm_Array __gc[]; //配列はコントラスタで切る。
public:
Class(); //コントラスタ
~Class(); //デストラクタ
int getInt();
void setInt(int a);
};
}
cppファイル(*.cpp)
#include "*.h" //ヘッダーファイルの読み込み
namespace NameSpace
{
Class::Class(void)
{
int i;
this->m_int = 0;
this->m_Array = new int __gc [10];
for(i = 0; i < 10; i++)this->m_Array[i] = 0;
return;
}
Class::~Class(void)
{
System::GC::SuppressFinalize(this);
Class::Finalize(); // 2005ではClass::Dispose();
}
int Class::getInt(void){return this->m_int}
void Class::setInt(int a){this->m_int = a; return;}
}