单项选择题
有如下程序:
#include<iostream>
using namespace std;
class test{
private:
int a;
public:
test(){cout<<"constructor"<<endl;}
test(int a){cout<<a<<endl;}
test(const test &_test){
a=_test.a;
cout<<"copy constructor"<<endl;
}
~test(){cout<<"destructor"<<endl;}
};
int main(){
test A(3);
return 0;
}
执行这个程序的输出结果是______。
- A.3
B.constructordestructor
C.copy constructordestructor
D.3destructor
点击查看答案&解析
相关考题
-
单项选择题
在多继承中,公有派生和私有派生对于基类成员在派生类中的可访问性与单继承的规则____。
A.完全相同
B.完全不同
C.部分相同
D.以上都不对 -
单项选择题
同一概念在一处为实体而在另一处为属性或联系的冲突在视图集成中称为______。
A.命名冲突
B.概念冲突
C.域冲突
D.约束冲突 -
单项选择题
下列字符串中,正确的C++标识符是____。
A.foo-1
B.2b
C.new
D._256
