首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Point{ public: Point(int xx=0,int yy=0):x(xx),y(yy) { } private: int x,
有如下类定义: class Point{ public: Point(int xx=0,int yy=0):x(xx),y(yy) { } private: int x,
admin
2021-09-05
114
问题
有如下类定义:
class Point{
public:
Point(int xx=0,int yy=0):x(xx),y(yy) { }
private:
int x,y;
};
class Circle:public Point{
public:
Circle(int r):radius(r) { }
private:
int radius;
};
派生类Circle中数据成员的个数为
选项
A、1
B、2
C、3
D、5
答案
C
解析
本题考查如何定义派生类以及派生类对基类成员的访问,声明派生类的一般形式为:
class 派生类名:[继承方式] 基类名 题目中公用继承,所以也继承基类的数据成员,所以总共有3个数据成员,所以C选项正确。
转载请注明原文地址:https://kaotiyun.com/show/OZfp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下程序:#inc1ude<iostream>usingnamespacestd;voidfunction2(intn);voidfunctionl(intn){if(n<=0)return;
执行下列语句段后,输出字符“*”的个数是()。for(inti=50;i>1-=2)cout<<ˊ*ˊ;
有如下程序:#include<iostream>#include<iomanip>usingnamespacestd;intmain(){ints[]={123,234};cout<<ri
下列关于虚基类的描述中,错误的是()。
下面描述中不属于数据库系统特点的是
若已定义了类Vehicle,则下列派生类定义中,错误的是()。
Windows环境下,由C++源程序文件编译而成的目标文件的扩展名是()。
已知函数f的原型是“voidflint*x,int&y);”,变量v1、v2的定义是“intv1,v2;”,下列调用语句中,正确的是()。
数据库设计过程不包括
下列叙述中正确的是()。
随机试题
加压蒸汽灭菌法,通常在多大压力下达121.3℃
冠心病心绞痛的病机总属是
男性,78岁,既往患冠心病30余年,因寒热,大汗,在当地医院诊断疟疾,下列哪种药慎用
6个月以下小儿免疫预防接种不包括
我国《合同法》的规定,合同中下列( )免责条款无效。
(1997年)设a1=2,证明:级数收敛.
下列关于漏洞扫描技术和工具的描述中,错误的是()。
LanguagesinAmericaTheUnitedStatesis【T1】______anEnglishspeakingcountry.The【T2】______ofthepopulationspeaksEnglis
A、Sheshouldbecarefulabouthowtospendhermoney.B、Sheshouldnotbuythebrownsuit.C、Sheshouldthinkcarefullywhenshe
CambridgeUniversitycloseddowninthesummerof1665whentheplaguebrokeout.Newton,astudentthere,wenthometoLincoln
最新回复
(
0
)