首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class TestClass l { public: virtual void fun(){cout
有如下程序: #include using namespace std; class TestClass l { public: virtual void fun(){cout
admin
2020-06-29
14
问题
有如下程序:
#include
using namespace std;
class TestClass l
{
public:
virtual void fun(){cout<<“l”;)
};
class TestClass2:public TestClass 1
{
public:
TestClass20{cout<<”2”;)
};
class TestClass3:publ
选项
A、1122
B、2112
C、2213
D、2223
答案
C
解析
主函数中定义TestClassl的对象aa,木p对象指针,TestClass2的对象bb以及TestClass3的对象cc。p指向cc,TestClass3为TestClass2的派生类,构造函数输出2。TestClass3中fun函数中为TestClass2中的fun,调用TestClass2的构造函数,输出2。“p一>fun();”,TestClass2继承于TestClassl中的fun,所以输出1。然后输出TestClass3中的“cout<<”3””,即输出3。
转载请注明原文地址:https://kaotiyun.com/show/lO8p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下函数模板定义:templateT1sum(T1a1){retum(a1+a2+a3);}则以下调用中正确的是()。
使用VC6打开考生文件夹下的源程序文件modi3.cpp,其中定义了类baseA、priAl和priA2,其中priAl类由baseA类公有派生,priA2类由priAl类公有派生。上述三个类的定义并不完整,请按要求完成下列操作,将程序补充完整。
当数据库中数据总体逻辑结构发生变化,而应用程序不受影响,称为数据的
某二叉树有5个度为2的结点,则该二叉树中的叶子结点数是( )。
要将前缀运算符--重载为Incr的非成员函数,下列原型中,可作为该重载函数原型的是
堆排序最坏情况下的时间复杂度为
若要对Data类中重载的加法运算符成员函数进行声明,下列选项中正确的是()。
使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错误,请改正错误,使得程序输出:Hellotest注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在∥********error***
使用VC6打开考生文件夹下的源程序文件modi.cpp,该程序运行时有错,请改正其中错误,使得程序正常运行,并使程序输出的结果为:cTest注意:不要改动main函数,不能增行或删行,也不能更改程序的结构,错误的语句在∥*******
某二叉树中有15个度为1的结点,16个度为2的结点,则该二叉树中总的结点数为
随机试题
G1P0,孕36周,子痫前期,最恰当的处理原则是()。
我国基本医疗保险组织参保、征收保险费的统筹单位原则上是
断路器应根据其使用条件校验()。
采用科目汇总表账务处理程序,科目对应关系不明显,不能直接通过总分类账查对账目。()
会计档案的整理、装订应由本单位的档案机构负责办理。()
船舶共同海损牺牲,船舶尚未修理的,( )。
下列选项中,不能作为选择标杆职位参考的标准的是()。
《黄鹤楼送孟浩然之广陵》的作者是()。
准实验研究
下列过程的功能是:通过对象变量返回当前窗体的Recordset属性记录集引用,消息框中输出记录集的记录(即窗体记录源)个数。SubGetRecNum()DimrsAsObjectSetrs=Me.RecordSetMsgBoxEnd
最新回复
(
0
)