首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
如下程序的输出结果是______。 #include<iostream> using namespace std; class Pet{ char name[10]; public: Pet(char*nan
如下程序的输出结果是______。 #include<iostream> using namespace std; class Pet{ char name[10]; public: Pet(char*nan
admin
2012-01-20
22
问题
如下程序的输出结果是______。
#include<iostream>
using namespace std;
class Pet{
char name[10];
public:
Pet(char*nanle){strcpy(this->name,name);}
const char*getName( )const{return name;}
virtual void call( )eonst=0;
};
class Dog:public Pet{
public:
Dog(char*name):Pet(name){ }
void call( )eonst{cout<<"汪汪叫";}
};
class Cat:public Pet{
public:
Cat(char*name):Pet(name){ }
void call( )const{eout<<"喵喵叫";}
};
int main( ){
Pet*petl=new Dog("哈克"),*pet2=new Cat("吉米");
eout<<petl->getName( );petl->call( );eout<<endl;
cout<<pet2->getName( );pet2->call( );eout<<endl;
return 0;
}
选项
答案
哈克汪汪叫 吉米喵喵叫
解析
转载请注明原文地址:https://jikaoti.com/ti/jfL0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序#include<stdio.h>main(){inta,b;for(a=0;a<3;a++){scanf("%d",&b);switch(b){case1:p
已知二叉树后序遍历序列是CDABE,中序遍历序列是CADEB,它的前序遍历序列是()。
有以下程序#defineF(X,Y)(X)木(Y)main(){inta=3,b:4;printf(“%d\n”,F(a++,b++));}程序运行后的输出结果是()。
有以下程序:#includemain(){inti=5:d0{if(i%3==1)if(i%5==2){printf(“*%d”,i);break;}i++:}
请编写函数fun,其功能是:将一组得分中,去掉一个最高分和一个最低分,然后求平均值,并通过函数返回。函数形参a指向存放得分的数组,形参n中存放得分个数(n>2)。例如,若输入9.98.57.68.59.39.58.97.8
执行以下语句段后,xy的值是()。int*pt,xy;xy=200;pt=&xy;xy=*pt+30;
函数rewind(fp)的作用是
数据库系统的三级模式不包括()。
算法的有穷性是指()。
数据字典是各类数据描述的集合,它通常包括5个部分,即数据项、数据结构、数据流;______和处理过程。
随机试题
根据公式,房地产评估值=房地产年收益额/资本化率,此公式假设前提包括【】
乙型肝炎病毒复制活跃乙型肝炎感染恢复,已产生免疫力
患者,男,48岁。口苦,心烦,闷胸不舒,入睡困难,舌质红,脉数。用药宜选()
外企白领朱某与王某于2006年4月结婚,二人进行了婚前财产公证,并订立了婚后财产的归属协议,协议约定:婚前个人财产以及结婚后双方各自取得的财产,归各自所有。2006年7月,朱某为出国进修借朋友李某30万元,后李某急需用钱,遂要求王某还款。以下关于本案的说法
黄强因遗嘱继承纠纷将其妹黄月诉至法院,并在质证时提出黄月举示父亲的自书遗嘱是伪造的,申请笔迹鉴定,法院准许。关于本案的鉴定,下列哪些说法是正确的?()
官府菜在规格上一般不低于宫廷菜,而又与庶民菜有极大的差别。()
有一阅览室,读者进入时必须先在一张登记表上登记,该表为每一座位列出一个表目,包括座号、姓名,读者离开时要注销登记信息;假如阅览室共有100个座位。试分别用信号量和P、V操作以及管程来实现用户进程的同步算法。
A、Theoldpackageiscolorless.B、Theoldpackageisuninteresting.C、Peopleshouldprotecttheenvironment.D、Theoldpackagei
A、Theexamisveryeasy.B、Berelaxandcalmandthenshewillmakeit.C、It’snecessarytobringadictionarywithher.D、It’s
Thefirststeptodefeatinganenemyistopindownhisexactidentityandhowheoperates.Hypertension—chronic,abnormallyrai
最新回复
(
0
)