[問題] Windows form全域變數

作者: skitty (aki)   2016-01-12 11:44:56
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
c++2010 Windows form
問題(Question):
我想要宣告一個全域用的變數和陣列
上網查資料在.h檔試了以下幾種:
1. Form1 底下宣告 int i
2. Form1底下宣告 int A[10]
3. Form1底下宣告 array<int^>^ Arry= gcnew array<int^>(10)
4. namespace底下宣告
public class A{
public: static int a1;
static int b1[10];
};
但是在.cpp檔main中都無法呼叫
ex 打Form1::i會說是不合法的
想請問是我宣告有誤還是呼叫有誤…
作者: kwpn (ITSST)   2016-01-12 21:06:00
int i沒宣告成static

Links booklink

Contact Us: admin [ a t ] ucptt.com