c++ - How to define a static member in case there is not header file? -


how define static member in case there not header file ?

the code:

class myclass { };  int myclass::staticmember;  // error: class myclass has no member staticmember! 

any help?

this work:

// // inside .cpp file // class myclass {     static int staticmember; };  int myclass::staticmember; 

Comments