有如下程序: #inCludeiostream using namespaCe std: Class CD{ publiC: ~CD{Cout’C’:} private: Char name[80]; }; int main{ CD a,*b,d[2]; return 0; 执行这个程序的输出结果是( )。A.CCCCB.CCCC.CCD.C
有如下程序: #inClude<iostream> using namespaCe std: Class CD{ publiC: ~CD{Cout<<’C’:} private: Char name[80]; }; int main{ CD a,*b,d[2]; return 0; 执行这个程序的输出结果是( )。
A.CCCC
B.CCC
C.CC
D.C
相关考题:
下列程序时类D代码段出现编译错误,原因是【 】。 include class A { public:A(char c) 下列程序时类D代码段出现编译错误,原因是【 】。include<iostream. h>class A{public:A(char c){cout<<"A's constructor."<<c<<endl;}~A(){cout<<"A's destructor."<<endl;}};class B: virtual public A{public:B(char cb,char cd):A(cb) {cout<<"B's constructor."<<cd<<endl;}~B(){cout<<"B's destructor."<<endl;}private:char b;};class C:virtual public A{public:C(char cc, char cd):A(cc){cout<<"C's constructor. "<<cd<<endl;}~C(){cout<<"C's destructor."<<endl;}};class D:public B,public C{public:D(char cd,char ce,char cf, char cg, char ch,char ci):C(cf,cg),B(cd,ce),A(cd),aa(ch){cout<<"D's constructor."<<ci<<endl;}~D() {cout<<"D's destructor."<<endl;}private:A aa;};void main(){D ohj('a','b','c','d','e','f')}
在下面程序中,A、B、C、D四句编译时不会出错的是()。include using namespace std;class 在下面程序中,A、B、C、D四句编译时不会出错的是( )。 #include <iostream> using namespace std; class Base{ public: Base(); Base(int e):count(C) {} virtual void print() const = 0; private: int count; }; class Derived :public Base{ public: Derived():Base(0) {} Derived(int C) :Base(C) {} void printt() const{cout<< "Derived"<<endl:} }; void main( ) { Derived d(10); Base *pb; pb = d; //A Base cb= d; Derived dd = *pb; //B Derived cd = cb; //C Base bb = d; //DA.AB.BC.CD.D
有如下程序:#includediostreamusing namespace std;class CD{public:~CD(){cout’C’;)private:char name[80];};int main()(CD a,*b,d[2];return 0;}运行时的输出结果是A.CCCCB.CCCC.CCD.C
请将如下程序补充完整,使得输出结果为:bbaa。 include using naluespace std; class 请将如下程序补充完整,使得输出结果为:bbaa。include<iostream>using naluespace std;class A{public:______{eout<<"aa";}};class B:public A{public:~B( ){eont<<"bb";}};int ulain( ){B*P=new B;delete P;return 0;}
如下的类定义,错误的语句是( )。class Myclass {public: int a=1; //A) Myclass( ); //B) Myclass(int i); //C) ~Myclass( ); //D)A.AB.BC.CD.D
阅读下列说明和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 C1的说明如下,错误的语句是() class C1{ int a;//(a) void //(b) public: C1(int val);//(c) ~C1();//(d) };A.aB.bC.cD.d