Why is the copy ctor used in this code?
问题 class A { public: A(const int n_); A(const A& that_); A& operator=(const A& that_); }; A::A(const int n_) { cout << "A::A(int), n_=" << n_ << endl; } A::A(const A& that_) // This is line 21 { cout << "A::A(const A&)" << endl; } A& A::operator=(const A& that_) { cout << "A::operator=(const A&)" << endl; } int foo(const A& a_) { return 20; } int main() { A a(foo(A(10))); // This is line 38 return 0; } Executing this code gives o/p: A::A(int), n_=10 A::A(int), n_=20 Apparently the copy