fork(1) download
  1. #include <iostream>
  2.  
  3. class A {
  4. static int counter;
  5. public:
  6. A();
  7. int getCounter() { return counter; }
  8. };
  9.  
  10. A::A() {
  11. counter++;
  12. }
  13.  
  14. int A::counter = 0;
  15.  
  16. int main()
  17. {
  18. A obj;
  19.  
  20. std::cout << obj.getCounter() << std::endl;
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
1