I tried to initialize a static member variable with a member initialization list. But I got errors like
static variable cannot be initialized via constructor
For example, my class sample
has a static member variable y
of type int
. I couldn't do this:
sample(int a):y(a){}
Why is that so?