首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的运行结果为( )。 #include class A { public: A(){cou|
下面程序的运行结果为( )。 #include class A { public: A(){cou|
admin
2020-07-23
71
问题
下面程序的运行结果为( )。
#include
class A
{
public:
A(){cou|<<’’1’’;}
~A(){cout<<’’2’’;}
};
class B:public A
{
public:
B(){cout<<’’3’’;}
~B(){cout<<’’4’’;}
};
void nlain()
{
B b:
}
选项
A、1234
B、1324
C、1342
D、3142
答案
C
解析
本题考查的是在继承中构造函数和析构函数的调用顺序,应该是先调用基类的构造函数,再调用派生类的构造函数,调用析构函数时的顺序是先调用派生类的析构函数,后调用基类的析构函数。
转载请注明原文地址:https://kaotiyun.com/show/nQyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下程序:#includeusingnamespacestd;intmain(){int*p;*p=9;cout
软件生命周期是指( )。
下列关于模板形参的叙述中,错误的是
有如下类定义:classPerson{public:Person(strings):name(s){}protected:stringname;
有如下两个类定义:classAA{};classBB{AAv1,*v2;BBv3;int*v4;};其中有一个成员变量的定义
将E-R图转换为关系模式时,实体和联系都可以表示为( )。
有如下类定义:classSample{public:Sample(intx):ref(x){}//1private:Sample(){ref=0;}//2staticintval
下列叙述中正确的是
在软件开发中,需求分析阶段可以使用的工具是( )。
在数据库中,数据模型包括数据结构、数据操作和
随机试题
应选用何种浓度的磷酸进行酸蚀操作过程中哪一项不正确
全国银行间市场债券托管账户是以( )的名义开立的。
Whenweconductforeigntrade,theimportanceofunderstandingthelanguageofacountrycannotbeunderestimated.Thesuccessfu
设,xn=xn-1+un,n=1,2,…,且u0=x0=1.证明xn存在。
下面程序错误的语句是①#include<iostream.h>②voidmain(0③{④int*p=newint[1];⑤p=9;⑥cout<<*p<<end1;
在关系运算中,查找满足一定条件的元组的运算称之为【】。
AmericanLiteratureAliteratureistherecordofhumanexperienceandpeoplehavealwaysbeenimpelledtowritedowntheirimpr
ThefirstmentionofslaveryinthestatutesoftheEnglishcoloniesofNorthAmericadoesnotoccuruntilafter1660—somefor
Excessivesugarhasastrongmal-effectonthefunctioningofactiveo【66】suchastheheart,kidneysandthebrain.Shipwrecked
A、Thesupermarketistoocrowded.B、Therearemanysupermarketshere.C、Look,justoverthere.D、Itiseleveno’clock.C本题问的是最近
最新回复
(
0
)