首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
如下程序的输出结果是______。 #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
20
问题
如下程序的输出结果是______。
#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/iRVp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
设有定义:structcomplex{intreal,unreal;}datal={1,8},data2;则以下赋值语句中错误的是()。
下列关于数据库设计的叙述中,正确的是()。
下列方法中,不属于软件调试方法的是()。
以下程序的输出结果是()。#includemain(){inta[3][3]={0,1,2,0,1,2,0,1,2},i,j,s=1;for(i=0;i
下列叙述中,不属于设计准则的是()。
在下列模式中,能够给出数据库物理存储结构与物理存取方法的是()。
下列算法中均以比较作为基本运算,则平均情况与最坏情况下的时间复杂度相同的是()。
在重载运算符函数时,下面运算符必须重载为类的成员函数的是()。
如果有以下定义及初始化:inta=3,*p=&a;则由此可以推断,*p的值是()。
如果有以下定义及初始化:inta=3,*p=&a;则由此可以推断,*cp的值是()。
随机试题
下列各项中,不属于日常业务预算的是【】
症见泄泻腹痛,泻下急迫,粪色黄褐,气味臭秽,肛门灼热,烦热口渴,小便短黄,舌质红,苔黄腻,脉濡数,辨证为
在实施基因治疗前,医务人员必须遵守有益于病人的原则,下列哪一点除外
最高管理者应指定()并明确其任务、职责、权限。
建设工程质量目标可以通过合同加以约定。对于合同约定的质量目标,必须保证其不得低于()要求的质量标准。
根据机器设备需要开动的数量和开动班次、工人看管定额,以及出勤率来计算定员人数的方法属于()。
杨柳被教室窗外的小鸟吸引,不能专心听讲。这属于()。(2012年上半年真题)
【B1】【B8】
如下图所示,网络端点A发送数据包给站点B,当Rl将数据包转发给R2时,被转发数据包中封装的目的IP地址和目的MAC地址是()。
下列VisualBasic函数中,计算结果为字符串型的是()。
最新回复
(
0
)