fork download
  1. #include <iostream>
  2.  
  3. struct A { void bar() { std::cout << "Expected outcome :)"; } };
  4. struct B { void bar() { std::cout << "Unexpected outcome :("; } };
  5.  
  6. A foo(int) { return A(); }
  7. B foo(char) { return B(); } // someone created this without telling me
  8.  
  9. int main()
  10. {
  11. auto x = foo('0');
  12. x.bar();
  13. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Unexpected outcome :(