首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序输出的结果是【 】。 #include <iostream> using namespace std; class A { public: virtual void show() {cout<<"A!";
下面程序输出的结果是【 】。 #include <iostream> using namespace std; class A { public: virtual void show() {cout<<"A!";
admin
2013-02-27
54
问题
下面程序输出的结果是【 】。
#include <iostream>
using namespace std;
class A {
public:
virtual void show() {cout<<"A!";
};
class B: public A {
public:
void show() {cout << "B!";}
};
class C: public B{
public:
void show(){cout << "C!";}
};
void show_info(A &i) {i. show();}
void main() {
A ia; B ib; C ic; show_info(ia);show_info(ib); show_info(ic); }
选项
答案
A! A! A!
解析
由于基类中没有声明虚函数,故调用的全部是基类的函数。
转载请注明原文地址:https://kaotiyun.com/show/PsNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序: structst{intx;int*y;}*pt; inta[]={1,2},b[]={3,4}; structstc[2]={10,a,20,b}; pt=c; 以下选项中表达式值为11的是()。
下列结构体类型说明和变量定义中正确的是()。
若有定义:intk=7,x=12;,则以下表达式值为3的是()。
若有定义语句:intx=10;,则表达式x-=x+x的值为()。
当一个进程在运行过程中释放了系统资源后要调用()。
在深度为5的完全二叉树中,度为2的结点数最多为【】。
数据处理的最小单位是()。
在长度为n的顺序表的第i(1≤i≤n+1)个位置上插入一个元素,元素的移动次数为【】。
对于下面程序,选项正确的是()。#include<iostream>usingnamespacestd;classpoint{public:voidsetpoint(un
在深度为7的满二叉树中,非叶子结点的个数为()。
随机试题
衡量数据传输有效性的主要指标是()率。
A、Adrugstore.B、Thenameofhighbuilding.C、Asupermarket.D、Thenameofastreet.A
"TheHeartoftheMatter",thejust-releasedreportbytheAmericanAcademyofArtsandSciences(AAAS),deservespraiseforaff
来源于菊科的药材有
与CHP对工作服的规定不符合的是
当计划工期等于计算工期时,()就是关键工作。
我国古代科举考试殿试中,“一甲”3名称为“赐进士出身”。()
下列词语中,没有错别字的一项是()。
ManypeopleinvestinthestockmarkethopingtofindthenextMicrosoftandDell.However,Iknowfrompersonalexperiencehow
Itmaybeinferredfromthepassagethat______.Intheauthor’sview,higherservicestandardsareimpossibleinIsrael______
最新回复
(
0
)