fork download
  1. struct Foo {
  2. void replaceBy(Foo*& foo, Foo* bar) {
  3. delete foo;
  4. foo = bar;
  5. }
  6. };
  7.  
  8. int main() {
  9. Foo *foo = new Foo;
  10. Foo *bar = new Foo;
  11. foo->replaceBy(foo, bar);
  12. delete bar;
  13. return 0;
  14. }
Success #stdin #stdout 0s 2956KB
stdin
Standard input is empty
stdout
Standard output is empty