网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
有如下程序:includeusing namespace std;class B{public:Virtual void show(){cout<<
有如下程序: #include<iostream> using namespace std; class B{ public: Virtual void show(){cout<<“B”;} }; class D:publicB{ public: void show(){cout<<“D”;} }; void funl(B*ptr){ptr->show();} void{un2(B&ref){ref.show();} void
A.BBB
B.BBD
C.DBB
D.DBD
参考答案
更多 “ 有如下程序:includeusing namespace std;class B{public:Virtual void show(){cout 有如下程序: #include<iostream> using namespace std; class B{ public: Virtual void show(){cout<<“B”;} }; class D:publicB{ public: void show(){cout<<“D”;} }; void funl(B*ptr){ptr->show();} void{un2(Bref){ref.show();} voidA.BBBB.BBDC.DBBD.DBD ” 相关考题
考题
有如下程序:includeusing namespace std;Class Base{public:Base(){cout
有如下程序: #include<iostream.h> using namespace std; Class Base { public: Base(){cout<<“BB”;f();} void{(){cout<<“BF”;} }; class Derived:public Base { public: Derived(){cout<<“DD”;} void f(){cout<<“Df”;) }; int mainA.BBBfDDB.BBDfDDDfC.DDD.DDBBBf
考题
下列程序的运行结果是【 】。 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()}
考题
有如下程序:includeusing namespace std;class B{public:virtual void show( ){cout
有如下程序: #include<iostream> using namespace std; class B{ public: virtual void show( ){cout<<"B";} }; class D:public B{ public: void show( ){cout<<"D";} }; void funl(B*ptr){ptr->show( );} void fun2(Bref);ref.show( );} void fun3(B b){b.show( );} int nlain( ){ B b,*P=Dew D; D d; funl(p); fun2(b); fun3(d); return 0; } 程序的输出结果是A.BBBB.BBDC.DBBD.DBD
考题
下面程序的结果是includeclass A{public:A( ){cout
下面程序的结果是 #include<iostream.h> class A { public: A( ) {cout<<"construtA"<<endl;} virtual~A( ) {cout<<"destructA"<<endl;}}; class B:public A {}; class C:public A {}; cA.constructA destructAB.constructA constructA destructA destructAC.constructA constructA constructA destructA destructA destructAD.constructA onstructA constructA constructA destructA destructA destructA destructA
考题
有如下程序:includeincludeusing namespace std;class BASE{char c;public
有如下程序: #include<iostream>#include<iosream> using namespace std; class BASE{ char c; public; BASE(char n):c(n){} virtual ~ BASE(){cout<<c;} }; class DERIVED; public BASE{ char c; public: DERIVED (char n): BASE (n+1)A.XYB.YXC.XD.Y
考题
有如下程序:include using namespace std;class AA{public: virtual void f() {cout
有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; claA.AAB.AABBCCC.BBAABBCCD.BBBBAACC
考题
下面程序输出的结果是【 】。 include using namespace std; class A { public:virtual
下面程序输出的结果是【 】。include <iostream>using namespace std;class A {public:virtual void show() {cout<<"A!";};class B: public A {public:void show() {cout << "B!";}};class C: public B{public:void show(){cout << "C!";}};void show_info(A i) {i. show();}void main() {A ia; B ib; C ic; show_info(ia);show_info(ib); show_info(ic); }
考题
有以下程序:include using namespace std;class A{public: virtual void show() {cout
有以下程序:include <iostream>using namespace std;class A{public:virtual void show(){cout<<"A";}};class B : public A{public:void show(){cout << "B";}};void display( A * obj ){obj-> show();}int main ( ){A demol;B demo2;display( demol );display( demo2 );return 0;}执行后的输出结果为【 】。
考题
阅读下列说明和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;}
热门标签
最新试卷