只举个例代码,让大家参考。
#include
class Test
{
private:
typedef int MYINT;
public:
typedef char MYCHAR;
static void Print(void)
{
MYINT nVar = 10;
cout<<"nVar = " << nVar << endl;
}
void Print2(void)
{
MYINT nVar = 101;
MYCHAR chVar = /'A/';
cout<<"nVar = " << nVar << " chVar = " << chVar << endl;
}
};
void main(void)
{
Test::MYCHAR chVar = 0;
//Test::MYINT nVar = 0; //error
Test test;
Test::Print();
test.Print2();
}
本文用
菊子曰发布