c++ - Definition of the static data member -
i'm reading scott meyers' c++ , come across example: class gameplayer{ private: static const int numturns = 5; int scores[numturns]; // ... }; what see above declaration numturns , not definition. why not definition? looks initialize static data member 5. i don't understand means declare not define variable value 5. can take address of variable fine. class { public: void foo(){ const int * p = &a; } private: static const int = 1; }; int main () { a; a.foo(); } demo because isn't definition. static data members must defined outside class definition. [class.static.data] / 2 the declaration of static data member in class definition is not definition , may of incomplete type other cv-qualified void . definition static data member shall appear in namespace scope enclosing member’s class definition. as taking address of static member without defining it, compile, shouldn't link.