fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class A {
  6. public:
  7. A(){};
  8. A(const A&x, const A& y){};
  9. A( const A& that ) {
  10. std::cout << " In copy" << std::endl;
  11. }
  12. };
  13.  
  14. A operator+(const A& x, const A& y) {
  15. return A(x, y);
  16. }
  17.  
  18. void f( const A& a) {
  19. std::cout << " In func" << std::endl;
  20. }
  21.  
  22. int main() {
  23. A a, b;
  24. f(a+b);
  25. std::cout << "run end" << '\n';
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
 In func
run end