   const static data member question
  I'm reading C++ Primer, Forth Edition and it states the following:When a const static data member is initialized in the class body, the data member must still be defined outside the class definition.But my compiler (MVSC++ 7) acutally doesn't complain when I don't define the const static data member outside the class as it states:class Foo{public:const static int k = 21;};// in main:Foo x;std::cout<<x.k<<std::endl; // okAm I misunderstanding this?Thanks,- xeddiex   
  Its fine for me too with visual c++ express.BTW you should acess  with Foo::k rather than x.k (is that even possible ?) since k is not a part of x instance (or it is shared between all instances)   ;Quote:Original post by jantaIts fine for me too with visual c++ express.BTW you should acess  with Foo::k rather than x.k (is that even possible ?) since k is not a part of x instance (or it is shared between all instances)Yes, it is perfectly legal the way I have it. But you are correct that I should instead qualify the member with the class name for clearity.- xeddiex   ;  it's fine. the book also says in section 12.6.2:Integral Types are Special"One exception to this rule is that a const static data member of integral type can be initialized within the class body as long as the initializer is a constant expression."   