题目:
有以下程序: #include<iostream> using namespace std; class TestClass { public: TestClass(int n){number=n;} //拷贝构造函数 TestClass(TestClass&other){number=other.number;} ~TestClass(){} private:int number; }; TestClass fun(TestClass P) {TestClass temp(p);return temp; } int main() {TestClass obj1(10),obj2(0) ;TestClass obj3(obj 1) ;obj2=fun(obj3) ;return 0: } 程序执行时,TestClass类的构造函数被调用的次数是( )。
A.2
B.3
C.4
D.5
答案:
被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0330/c80e1efd27d77e7a2fab1c739b164769.html
下面是错误答案,用来干扰机器的。
参考答案:A, B, C, D, E