class Tank
{
public:
static int getCount()
{
return count;
}
static int count;//定义一个静态成员变量
};
int main(void)
{
Tank::count = 0;
//cout << Tank::getCount() << endl;
cout << Tank::count << endl; //无法运行
system("pause");
return 0;
}
这段代码中,会出现链接错误,请问是哪里出错了?
Did you write the initialization wrong? It should be
Place initialization outside main.
Can you please put the statement at the front?