static member variable inside class 
Author Message
 static member variable inside class

Please note that static data members must be initialized at file scope.  

class Foo
   static int nTest;  


int Foo::nTest = 1;  // the static member should be initialized at file
scope. Otherwise, you get a lnk2002 complaint.

Enter "static" for more related information in MSDN.


This posting is provided "AS IS" with no warranties, and confers no rights.

Sat, 10 Jul 2004 14:43:10 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Static variables inside a class, in an extension DLL

2. LNK1169 & static const class member variables

3. write to static class member variable...

4. Static member variables of template class

5. writing to static class member variable...

6. static template class member variable in DLL

7. write to static class member variable....

8. static function access member variable and member function

9. mutual class include problem: accessing members from one class from inside another

10. does static class member change class size?

11. Class object as static member of another class

12. How to access a member variable of a class from other class


Powered by phpBB® Forum Software