fork(14) download
  1. #include <iostream>
  2.  
  3. // Myclass.h
  4. class MyClass
  5. {
  6. public:
  7. static int DoSomethingWithTheVar()
  8. {
  9. TheVar = 10;
  10. return TheVar;
  11. }
  12. private:
  13. static int TheVar;
  14. };
  15.  
  16. // Myclass.cpp
  17. // #include "Myclass.h"
  18.  
  19. int MyClass::TheVar = 0;
  20.  
  21. int main()
  22. {
  23. std::cout << MyClass::DoSomethingWithTheVar() << std::endl;
  24. return 0;
  25. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
10