I am trying to define a public static variable like this :
public :
static int j=0; //or any other value too
I am getting a compilation error on this very line : ISO C++ forbids in-class initialization of non-const static member `j'.
Why is it not allowed in C++ ?
Why are const members allowed to be initialized ?
Does this mean static variables in C++ are not initialized with 0 as in C?
Thanks !
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…