fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. struct A
  7. {
  8. A(int x)
  9. {
  10. x = x;
  11. }
  12.  
  13. int x = 42;
  14. };
  15.  
  16. struct B
  17. {
  18. B(int x)
  19. {
  20. this->x = x;
  21. }
  22.  
  23. int x = 42;
  24. };
  25.  
  26. int main()
  27. {
  28. A a(1);
  29. B b(1);
  30.  
  31. cout << a.x << endl;
  32. cout << b.x << endl;
  33. }
  34.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
42
1