私は次のコードを使おうとしていました:
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
上記の実装の何が問題になっていますか?