fork(2) download
  1. #include <iostream>
  2.  
  3. struct Type {
  4. int a, b, c;
  5. int& ref;
  6. Type(int m) : a(m), b(m), c(m), ref(a) { }
  7. };
  8.  
  9. int main() {
  10. Type a(42);
  11. Type b(a);
  12.  
  13. std::cout << &a.ref << " " << &b.ref << std::endl;
  14. std::cout << &a.a << " " << &b.a << std::endl;
  15. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0xbf92e090  0xbf92e090
0xbf92e090  0xbf92e0a0