fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. class Test
  7. {
  8. public:
  9. Test operator + (Test&) { cout << "1\n"; return Test(); }
  10. Test operator + (const Test&) { cout << "2\n"; return Test(); }
  11. Test operator + (const Test&) const { cout << "3\n"; return Test(); }
  12. };
  13.  
  14. const Test f() { return Test(); }
  15.  
  16. int main(int argc, const char * argv[])
  17. {
  18. Test a, b;
  19.  
  20. a + b;
  21. a + f();
  22. f() + f();
  23.  
  24. }
  25.  
  26.  
Success #stdin #stdout 0s 4372KB
stdin
Standard input is empty
stdout
1
2
3