fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. struct Hello{
  5. int a;
  6. Hello():a(0){}
  7. int world(){
  8. return ++a;
  9. }
  10. };
  11.  
  12. int main()
  13. {
  14. Hello test;
  15. std::cout << test.world() << std::endl;
  16. std::cout << test.world() << std::endl;
  17. std::cout << test.world() << std::endl;
  18. std::cout << test.world() << std::endl;
  19. }
  20.  
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
1
2
3
4