fork download
  1. #include <iostream>
  2. #include <vector>
  3. class Test
  4. {
  5. public:
  6. void kek()
  7. {
  8. n++;
  9. };
  10. void kok()
  11. {
  12. std::cout << n << '\n';
  13. };
  14. private:
  15. int n = 0;
  16. };
  17.  
  18. int main()
  19. {
  20. std::vector<Test> test;
  21. for (int i = 0; i < 5; i++) {
  22. test.push_back(Test());
  23. }
  24. for (auto it = test.begin(); it != test.end(); it++) {
  25. it->kek();
  26. }
  27. for (auto it = test.begin(); it != test.end(); it++) {
  28. it->kok();
  29. }
  30. //int g;
  31. //std::cin >> g;
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
1
1
1
1
1