I was trying to use the following code:
class Test
{
private:
static int x;
public:
Test(int i) : x(i) {}
};
main()
{
Test a(5);
}
但是,后来我遇到了这个错误:
‘int Test::x’ is a static data member; it can only be initialized at its definition
上述实现有哪些问题?