What constructor or operator is used in a return (C++)
问题 I run this code for experimenting copy constructor and assignment operator class AClass { private: int a; public: AClass (int a_) : a(a_) { cout << " constructor AClass(int) " << a << endl; } AClass(const AClass & x) : a(x.a) { cout << " copy constructor AClass(const AClass &) " << a << endl; } AClass & operator=(const AClass & x) { a = x.a; cout << " AClass& operator=(const AClass &) " << a - endl; return *this; } }; AClass g () { AClass x(8); return x; } int main () { cout << " before