KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 !
Tags (comma-separated)
Save Edits
Cancel