首页 > 试题广场 >

下面 C++ 代码的运行结果是() #include io

[单选题]
下面 C++ 代码的运行结果是()
#include <iostream>

using std::cout;
using std::endl;
using std::move;

struct Test {  
    Test() = default;
    Test(const Test& that) {
      cout << "copy constructor" << endl;
    }
    Test& operator=(const Test& rhs) {
      cout << "copy assignment operator" << endl;
      return *this;
    }
};

int main() {
  Test a, b;
  a = b;
  Test c = move(b);
  return 0;
}
  • copy assignment constructor
    copy constructor
  • copy assignment constructor
    copy assignment operator
  • 编译错误
  • 运行错误
不是,啥是赋值构造函数?A里面的字符串是怎么来的?怎么能拼出copy assignment constructor?
发表于 2025-08-22 21:49:51 回复(1)