
引用添加向?qū)С绦驅(qū)⑾虍?dāng)前工程文件中增加對(duì)相關(guān)庫(kù)的引用:
③ 調(diào)用mcmath名稱空間,創(chuàng)建 mcmathcomp 的對(duì)象,并調(diào)用其方法和屬性。
現(xiàn)在距離調(diào)用組件的方法和屬性只有一步之遙了。請(qǐng)按照以下步驟進(jìn)行:
●引用名稱空間:using mcmath
●創(chuàng)建一個(gè) mcmathcomp的對(duì)象:mcmathcomp cls = new mcmathcomp();
●調(diào)用方法和屬性
mcmathcomp cls = new mcmathcomp();
long lres = cls.add( 23, 40 );
cls.extra = false;
以下是完整的工程文件代碼:
namespace mcclient
{
using system;
using mcmath;
/// <summary>
/// summary description for class1.
/// </summary>
public class class1
{
public class1()
{
//
// todo: add constructor logic here
//
}
public static int main(string[] args)
{
mcmathcomp cls = new mcmathcomp();
long lres = cls.add( 23, 40 );
cls.extra = false;
return 0;
}
}
}
請(qǐng)下載工程文件: mcmath.zip
新聞熱點(diǎn)
疑難解答
圖片精選