[問題] 建構子問題
class Time
{
public:
Time(){count=999;}
static int howmany(){count++;return count;}
private:
static int count;
};
int _tmain(int argc, _TCHAR* argv[])
{
Time x;
cout<<x.howmany()<<endl;
//cout<<Time::howmany()<<endl;
system("pause");
return 0;
}
請問一下各位 這裡我將count設成靜態為什麼會出現錯誤?
還有這行 cout<<Time::howmany()<<endl;
::這裡是什麼意思? 這行編譯有過不了
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.233.165.225
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1403352915.A.DD9.html
→
06/21 22:30, , 1F
06/21 22:30, 1F
推
06/22 09:36, , 2F
06/22 09:36, 2F