首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class test{ private: int a; public: test(){tout
有如下程序: #include using namespace std; class test{ private: int a; public: test(){tout
admin
2020-06-29
16
问题
有如下程序:
#include
using namespace std;
class test{
private:
int a;
public:
test(){tout<<"constructor"<
test(int a){cout<
test(const test&_test){
a=_test.a;
tout<<”copy constructor”<
}
~test(){cout(<"destructor"<
};
int main(){
test A(3);
retum 0;
}
执行这个程序的输出结果是( )。
选项
A、3
B、constructor
destructor
C、copy constructor
destructor
D、3
destructor
答案
D
解析
本题考查默认构造函数和带参数的构造函数以及析构函数,本题中定义了一个对象A(3),对象带着参数,所以执行带参数的构造函数,输出3,然后执行析构函数,输出destructor。所以本题答案为D。
转载请注明原文地址:https://jikaoti.com/ti/f0A0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列字符串中,正确的C++标识符是
在公有派生的情况下,派生类中定义的成员函数只能访问原基类的
一个类的友元函数或友元类能够通过成员操作符访问该类的()。
有如下模板声明:templateclassA;下列声明中,与上述声明不等价的是()。
将前缀运算符“一”重载为非成员函数,下列原型中,能正确用于类中说明的是()。
在公有继承的情况下,允许派生类直接访问的基类成员包括()。
下面能作为软件需求分析工具的是
有如下头文件:intf1();staticintf2();classMA{public:intf3();staticintf4();};在所描述的函数中,具有隐含的this指针的是()。
设二叉树如下:则后序序列为
随机试题
我国现存最大的类书是()。
Formostofhumanhistoryrichpeoplehadthemostleisure.Ontheotherhand,thepoorhavetypicallyworkedpersistently.Hans
真菌的繁殖方式,不包括
男性,66岁,反复咳嗽、咳痰30余年,进行性呼吸困难10余年,反复双下肢水肿2年。因咳嗽、咳痰加重3天人院。查体:口唇发绀,颈静脉怒张,球结膜充血水肿,桶状胸,双肺叩诊呈过清音,呼吸30次/分,双下肺可闻及细湿哕音,双下肢呈可凹性水肿。病理反射未引出。X线
支气管哮喘急性发作伴窦性心动过速,哪项治疗不正确
感染性肉芽肿的特征性细胞成分是
以下检测方法中,()不能用于混凝土强度的检测。
工程监理规划是工程监理单位根据委托工程监理合同制定的。指导监理组织全面开展监理工作的纲领性文件,由()主持编制。
外国人需要延长签证停留期限的,应当在签证注明的停留期限届满()前向停留地县级以上地方人民政府公安机关出入境管理机构申请。
Theuseofdeferential(敬重的)languageissymbolicoftheConfucianidealofthewoman,whichdominatesconservativegendernorms
最新回复
(
0
)