填空题
指出下面程序段中的错误,并说明出错原因
[13]
。
class Location
int X, Y=20;
protected:
int zeroX, zeroY;
int SetZero(int ZeroX, iht ZeroY);
private:
int length, height;
public:
float radius;
void init(int initX,int initY);
int GetX();
Int GetY();
;
【参考答案】
int X,Y=B0; 出错,不能采用这种方式初始化
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
下列程序的运行结果是 [12] 。 include <iostream. h> class Sample int x,y; public: Sample() x=y=0; Sample(int a, int b) x=a;y=b; void disp() cout<< x= <<x<< , y= <<y<<end1; ; void main() Sample s1, s2(1, 2); s1. disp0; s2. disp ();
点击查看答案
填空题
以下程序的输出结果是 [11] 。 #include<iostream. h> void main() int a[]= 1, 3, 5, 7, *p=a, i; for (i=0; i<4: i++) a[i]=*p++; cout<<a[2];
点击查看答案
相关试题
类的成员函数中,只能用于检测输入操作的函...
对于派生类的构造函数,在定义对象时构造函...