fork download
  1. #include <iostream>
  2. class c {
  3. int a;
  4. public:
  5. c() { a = 31415926; }
  6. int &left() { return a; }
  7. int right() { return a; }
  8. };
  9. int main() {
  10. c a;
  11. a.left() = 27182818;
  12. std::cout << a.right() << std::endl;
  13. return 0;
  14. }
  15. /* end */
  16.  
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
27182818