对于类定义 class A{ public: virtual void func1( ){} void func2( ){} }; class B:public A{ public: void func1( ){cout<<"class B func 1"< < end1;} virtual void func2( ){cout << "class B func2"<< end1;} }; 下面正确的A.A::func2( )和B::func1( )都是虚函数B.A::func2( )和B::func1( )都不是虚函数C.B::func1( )是虚函数,而A::func2( )不是虚函数D.B::func1( )不是虚函数,而A::func2( )是虚函数
对于类定义 class A{ public: virtual void func1( ){} void func2( ){} }; class B:public A{ public: void func1( ){cout<<"class B func 1"< < end1;} virtual void func2( ){cout << "class B func2"<< end1;} }; 下面正确的
A.A::func2( )和B::func1( )都是虚函数
B.A::func2( )和B::func1( )都不是虚函数
C.B::func1( )是虚函数,而A::func2( )不是虚函数
D.B::func1( )不是虚函数,而A::func2( )是虚函数
相关考题:
对于类定义: class A{ public: virtual void func1( ){} void func2( ){} }; class B:public A{ public: void func1(){cout<<"class B func 1"<<end1;} virtual void func2(){cout<<"class B func 2"<<end1;} }; 下面叙述正确的是(53)。A.A∷func2()和B∷func1()都是虚函数B.A∷func2()和B∷func1()都不是虚函数C.B∷func1()是虚函数,而A∷func2()不是虚函数D.B∷func1()不是虚函数,而A∷func2()是虚函数
对于类定义class A{public:virtual void func1( ) {}void func2( ) {}};class B: public A{public:void func1( ) {cout < < "class B func 1" < < endl;}virtua1 void func2( ) {cout < < "class B func 2" < < endl;}};下面正确的叙述是A.A: :func2( ) 和B: :func1( ) 都是虚函数B.A: :func2( ) 和B: :func1( ) 都不是虚函数C.B: :func1( ) 是虚函数,而A: :func2( ) 不是虚函数D.B: :func1( ) 不是虚函数,而A: :func2( ) 是虚函数
下列程序的运行结果是【 】。 include class SomeClass { public: SomeClass(int va 下列程序的运行结果是【 】。include <iostream. h>class SomeClass{public:SomeClass(int value) { some_value=value;};void show_data(void) { cout<<data<<"<<~some_value<<endl; };static void set_data(int value) {data=value; }private:static int data;int some_value};int SomeClass::datavoid main(void){SomeClass my_class(1001),your_class(2002);your_class. set_data(4004);my_elass. show_data()}
对于类定义: classA{ public: virtualvoidfuncl(){} voidfunc2(){} }; classB:publicA{ public: voidfuncl(){cout"classBfunc1"endl;} virtualvoidfunc2(){cout"classBfunc2" endl;} }; 下面正确的叙述是( )。A.A::func2( )和B::func1( )都赵虚函数B.A::rune2( )和B::func1( )都不是虚函数C.B::func1( )是虚函数,而A::fune2( )不是虚函数D.B::func1( )不是虚函数,而A::func2( )是虚函数
对于下面( )类定义,可以通过“newJ_Class()”生成类J_Class的实例对象。A、publicclassJ_Class{publicJ_Class(void){}}B、publicclassJ_Class{}C、publicclassJ_Class{publicJ_Class(Strings){}}D、publicclassJ_Class{publicvoidJ_Class(){}publicJ_Class(Strings){}
对于类定义: class A{ public: virtual void func1(){} Void func2 (){} }; class B:public A{ public: void func1(){cout<<"class B func 1"<<end1;} virtual void func2(){cout<<"class B func 2"<<end1;} };下面叙述正确的是( )。A.A::func2()和B::func1()都是虚函数B.A::func2()和B::func1()都不是虚函数C.B::func1()是虚函数,而A::func2()不是虚函数D.B::func1()不是虚函数,而A::func2()是虚函数
阅读以下说明和Java程序,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下Java代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分接口、类及其关系如图5-1所示。【Java代码】interface?DrawCircle?{? //绘制圆形 public(1) ;}class?RedCircle?implements?DrawCircle?{? ?//绘制红色圆形???????public?void?drawCircle(int?radius,intx,?int?y)??{????????????System.out.println("Drawing?Circle[red,radius:"?+?radius?+",x:"?+?x?+?",y:"?+y+?"]");???????}}class?GreenCircle?implements?DrawCircle?{????//绘制绿色圆形??????public?void?drawCircle(int?radius,?int?x,int?y)?{???????????System.out.println("Drawing?Circle[green,radius:"?+radius+",x:?"?+x+?",y:?"?+y+?"]");??????}}abstract?class?Shape?{????//形状? protected? ? (2)???;? ? public?Shape(DrawCircle?drawCircle)?{? ?this.drawCircle=?drawCircle;? ? ? public?abstract?void?draw();}class?Circle?extends?Shape?{? //圆形? ?private?int?x,y,radius;? public?Circle(int?x,int?y,intradius,DrawCircle?drawCircle)?{? ?(3)???;? this.x?=?x;? ? ? this.y?=?y;? ?this.radius?=radius;? }? ? ?public?void?draw()?{? ? drawCircle.? ?(4)? ?;? ? ? }}public?class?DrawCircleMain?{? public?static?void?main(String[]?args)?{? Shape?redCircle=new?Circle(?100,100,10,? (5) );//绘制红色圆形? Shape?greenCircle=new?Circle(200,200,10,(6) );//绘制绿色圆形? ?redCircle.draw(); greenCircle.draw();? ?}}
阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。【C++代码】#include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}
对于以下类定义,下面正确的叙述是 。 class A { public: virtual void func1(){ } void func2(){ } }; class B:public A{ public: void func1(){cout<< ″ class B func 1 ″ <<end1;} virtual void func2(){cout<< ″ class B func 2 ″ <<end1;} };A.:func2() 和 B::func1() 都是虚函数B.A::func2() 和 B::func1() 都不是虚函数C.B::func1() 是虚函数,而 A::func2() 不是虚函数D.B::func1() 不是虚函数,而 A::func2() 是虚函数