首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class Point{ public: Point(int xx=0,int yy=0):x(xx),
有如下程序: #include using namespace std; class Point{ public: Point(int xx=0,int yy=0):x(xx),
admin
2019-05-22
23
问题
有如下程序:
#include
using namespace std;
class Point{
public:
Point(int xx=0,int yy=0):x(xx),y(yy) { }
void SetXY(int xx,int yy) { x=xx; y=yy; }
protected:
int x,y;
};
class Circle:Point{
public:
Circle(int r):radius(r) { }
void Set(int r,int x,int y) { radius=r; SetXY(x,y); } //①
void Print() const { cout<
private:
int radius;
};
int main(){
Circle c1(5);
c1.SetXY(10,1,2); //③
c1.Print(); //④
return 0;
}
在标有号码的语句行中存在语法错误的是
选项
A、①
B、②
C、③
D、④
答案
C
解析
C选项中SetXY为基类的成员函数,派生类也继承下来,但是SetXY的参数为两个,而③调用时是3个参数,所以错误。
转载请注明原文地址:https://kaotiyun.com/show/MI8p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
结构化程序设计的基本原则不包括
A、 B、 C、 D、 B在面向对象程序设计中,允许作用于某个对象上的操作称为方法,方法是对象的动态属性。对象间的通信靠消息传递。对象是属性和方法的封装体,可以从祖先中继承属性和方法,但不是任何对象都具有继承
下列程序的输出结果是______。#include<iostream>#include<cstring>usingnamespacestd;voidfun(constchar*S,char&C){e=
A、 B、 C、 D、 B算法的空间复杂度一般是指:执行这个算法所需要的存储空间,其中包括算法程序所占的空间、输入的初始数据所占用的存储空间以及算法执行过程中所需要的额外空间。
面向对象程序设计主要经历了结构化设计和面向对象的程序设计阶段,面向对象在现在的程序设计中得到广泛的应用。
有如下程序:#include<iostream>usingnamespacestd;intmain(){charstr[100],*P;cout<<"pleaseinputastring:
随机试题
一般认为管理过程学派的创始人是()。
Abouttenmenineveryhundredsufferfromcolorblindnessinsomeway;womenareluckieronlyaboutoneintwohundredisaffec
A.向下颌方向缓慢刺入0.5~1.5寸B.针尖微向下,向鼻尖方向缓慢刺入0.8~1.2寸C.向下颌方向缓慢刺入0.5~1寸D.向眼球方向缓慢刺入0.5~1寸用毫针刺风池穴,正确的操作手法是
肝细胞凋亡可见肺硅沉着症可见
A.上斜肌B.下斜肌C.外直肌D.眼轮匝肌E.瞳孔开大肌动眼神经支配的肌肉是
患者,女性,55岁。高血压病史10年,因未规律用药,血压控制不理想,多在160/105mmHg。4小时前患者心前区持续疼痛、出冷汗来院急诊,诊断为急性心肌梗死。半小时前患者呼吸困难伴喘息,两肺布满湿哕音和哮鸣音,心率108/分,律齐。首先考虑该患者的病情变
商业发票是国际货物买卖中的核心单据,其作用表现为()。
运营环境变化对电信企业运营提出了新的要求,表现在()。
我国投入巨额资金实施退耕还林工程,这说明()。
EgyptianwinehasanextensivehistorywithinthehistoryofEgyptiancivilization.Grapeswerenot(1)_____tothelandscapeof
最新回复
(
0
)