fork(1) download
  1. #include <iostream>
  2.  
  3. static int num = 0;
  4. class TestClass
  5. {
  6. public:
  7. int a;
  8. float b;
  9. TestClass(float f)
  10. {
  11. a = 55;
  12. b = f;
  13. ++num;
  14. }
  15. };
  16. TestClass test(32);
  17.  
  18. int main(int argc,char *argv[])
  19. {
  20. std::cout<<"Int: "<<test.a<<std::endl;
  21. std::cout<<"Float: "<<test.b<<std::endl;
  22. std::cout<<"Constructor has been called "<<num<<" times"<<std::endl;
  23. return 0;
  24. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
Int: 55
Float: 32
Constructor has been called 1 times