i6lan 分享题目的网站
试一试站内搜索 题目类型:问答题

中国共产党第一次代表大会召开的
《中华人民共和国消防法》规定,
以下关于价值流图,错误的是?
数字调制方式有()。
我国农业合作化过程中建立的初级

改错题


 #include <iostream.h>

class shape

{public:

virtual int area(){return 0;}

};

class rectangle:public shape

{public:

int a, b;

void setLength (int x, int y) {a=x;b=y;}

int area() {return a*b;}

};

void main()

{rectangle r;

r.setLength(3,5);

shape s1,*s2=&r;

cout <<r.area() <<endl;

s2=s1;

cout <<s2.area()<<endl;

}


答案:shape s1,*s2=r;指针使用错误。s是指针使用它指向对象的成员有两种方法,有下面两行可知,使用的是引用。[修改]改为shape &s=r;

上一题 下一题

CopyRight©i6lan.com 关于本站
蜀ICP备2021017061号-1

川公网安备 51010402001278号