fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct foo {
  5. int& a;
  6. foo(int& b) : a(b) {}
  7. void bar() const {
  8. a = 5;
  9. }
  10. };
  11.  
  12.  
  13. int main() {
  14. int x = 10;
  15. cout << x << endl;
  16. const foo f(x);
  17. f.bar();
  18. cout << x << endl;
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
10
5