fork(1) download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. struct A
  6. {
  7. int x;
  8. int y;
  9. int z;
  10.  
  11. int foo()
  12. {
  13. std::cout << "enter foo: " << this->x << "," << this->y << "," << this->z << std::endl;
  14. return 5;
  15. }
  16.  
  17. int moo()
  18. {
  19. std::cout << "enter moo: " << this->x << "," << this->y << "," << this->z << std::endl;
  20. this->x = 1;
  21. this->z = 10;
  22. return 2;
  23. }
  24. };
  25.  
  26. A b { b.foo(), b.z = b.moo(), 3};
  27.  
  28. std::cout << "final: " << b.x << "," << b.y << "," << b.z << std::endl;
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 4268KB
stdin
Standard input is empty
stdout
enter foo: 0,0,3
enter moo: 5,0,3
final: 1,2,2