fork download
  1. #include <iostream>
  2.  
  3. void foo( void );
  4.  
  5. class Test
  6. {
  7. public:
  8. static int a;
  9. };
  10.  
  11. int Test::a = 0; //initializing
  12.  
  13. int main()
  14. {
  15. std::cout << Test::a << std::endl;
  16.  
  17. Test::a = 10;
  18. std::cout << Test::a << std::endl;
  19.  
  20. foo();
  21. std::cout << Test::a << std::endl;
  22.  
  23. return 0;
  24. }
  25.  
  26. void foo( void )
  27. {
  28. Test::a = 100;
  29. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0
10
100