首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
如下程序的输出结果是______。 #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://kaotiyun.com/show/IWVp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是()。
运行下面的程序,输入字符串MicrosoftVisualStudio,则程序的执行结果是()。#include<stdio.h>main(){charChr[20];scanf("%s",&Chr
有以下程序#include<stdio.h>main(){charb[4][10];inti;for(i=0;i<4;i++)scanf("%s",b[i]);for(i
以下叙述中正确的是
设有定义#include#includetypedefstruet{intx,y;}T;typedefstruet{intx,y;}*USER;USERfun(){USERp;
若以“a+”方式打开一个已存在的文件,以下叙述正确的是()。
某循环队列的存储空间为Q(1:m),初始状态为front=rear=m。现经过一系列的入队操作和退队操作后,front=m,rear=m-1,则该循环队列中的元素个数为
人员的记录由编号和出生年、月、日组成,N名人员的数据已在主函数中存入结构体数组std中。函数fun的功能是:找出指定出生年份的人员,将其数据放在形参k所指的数组中,由主函数输出,同时由函数值返回满足指定条件的人数。请在程序的下划线处填入正确的内容
在一棵二叉树上,第5层的结点数最多是()。
随机试题
某患者,男,65岁。肝硬化病史10余年,有腹水。未规律服用利尿剂治疗,近日来出现嗜睡。体检:轻度黄疸,测血钠120mmol/L,血钾2.6mmol/L,氯化物90mmol/L,BUN10mmol/L,血pH7.5。以下最佳治疗方案是(
必须制订制剂的中间体,成品检验操作规程,建立取样、留样制度的是必须有配制规程和标准操作规程的是
指示提单经过背书的可转让,又具有一定保护性,故在国际贸易中广为使用。()
下列选项中,解释利率期限结构的理论包括()。
(2016·河北)在公告的总体结构中,可以没有的一部分是()
下列关于认识错误的说法正确的有()。
A、 B、 C、 D、 B
在SQLServer2008中,某数据库用户User在此数据库中具有对于表数据的查询和更改权限。现要收回User对于T表的数据更改权,下述是实现该功能的语句,请补全该语句。【8】UPDATEONTFRoMUser。
下面程序段的运行结果是 a=1 b=1 Do a=a+1 b=b+1 LoopUntilb>5 Print"k=";a;Spc(4);"b=";b+a
Whatisthenewsmainlyabout?
最新回复
(
0
)