填空题
多态性分为两类:编译时的多态性和______。
【参考答案】
运行时的多态性
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列程序中,先声明一个圆类circle和一个桌子类table,另外声明一个圆桌类roundtable,它是由 circle和table两个类派生的,要求声明一个圆桌类对象,并输出圆桌的高度,面积和颜色。请填空完成程序 #include<iostream.h> #include<string.h> class circle double radius; public: circle(double r)radius=r; double get_area()return 3.416*radius*radius; ; class table double height; public: table(double h)<height=h; double get_height()return height; ; class roundtable:public table,public circle char *color; public: roundtable(double h,double r,char c[]): [10] color=new char[strlen(c) +1]; [11] ; ; char*get_color()return color; : void main() roundtable rt(0.8,1.0,“白色”); cout<< 圆桌的高: <<rt. get_height()<<end1; cout<< 圆桌面积: <<rt.get_area()<<end1; cout<< 圆桌颜色: <<n.get color()<<end1;
点击查看答案
填空题
类中包含了一个静态成员函数,则main函数中和P.f1(P);语句具有同样功能的语句为______。 #include<iostream.h> class M public: M(int A)A=a;B+=a; static void f1(M m); private: int A; static int B;; void M::f1(M m) cout<< A= <<m.A<<endl; cout<< B= <<m.B<<endl; int M::B=10; void main() M P(5); P.f1(P);
点击查看答案&解析
相关试题
友元类的所有成员函数都是另一个类的___...
下面程序要实现的功能是打开当前目录下的文...
目前,有两种重要的高级语言,分别是结构化...
程序的输出结果是______。 #includ...
Jackson结构化程序设计方法是英国的M.Jack...