有如下类定义: class XX{ int xdata: public: xx(int n=0):xdata(n){} } class YY:public XX{ int ydata; public: YY(int m=0,int n=0):xx(m),ydata(n){ } {; YY类的对象包含的数据成员的个数是A.1B.2C.3D.4
有如下类定义: class XX{ int xdata: public: xx(int n=0):xdata(n){} } class YY:public XX{ int ydata; public: YY(int m=0,int n=0):xx(m),ydata(n){ } {; YY类的对象包含的数据成员的个数是
A.1
B.2
C.3
D.4
相关考题:
( 31 )有如下类定义:class XX{int xx;public:XX ( ) : xx ( 0 ) {cout' A';}XX ( int n ) : xx ( n ) {tout' B';}};Class YY:public XX{Int yy;public:YY ( ) : yy ( 0 ) {cout+yy;}YY ( int n ) : XX ( n+1 ) , yy ( n ) {coutyy;}YY ( int m, int n ) : XX ( m ) , yy ( n ) {coutyy;}};下列选项中,输出结果为 A0 的语句是A ) YY y1(0,0);B ) YY y2(1);C ) YY y3(0);D ) YY y4;
( 13 )有如下类定义:class XX{int xdata;public:XX(int n=0) : xdata (n) { }};class YY : public XX{int ydata;public:YY(int m=0, int n=0) : XX(m), ydata(n) { }};YY 类的对象包含的数据成员的个数是A ) 1B ) 2C ) 3D ) 4
有如下程序:includeusing namespace std;class XX{protected:int k;public:XX(int n= 有如下程序: #include<iostream> using namespace std; class XX { protected: int k; public: XX(int n=5):k(n){}; ~XX() { cout<<"XX": } virtual void f()const=0; }; inline void XX::f()const { cout<<k+3; }; class YY:public XX { public: ~YY() { cout<<”YY”; } void f()const { cout<<k-3; XX::f(); } }; int main() { XX p=*new YY; P.f(); delete p; return 0: } 执行上面的程序将输出( )。A.28XXB.28YYXXC.33XXD.33XXYY
有如下类定义:class XX{int xdata;public:xx(int n=O):xdata(n){}};class YY:public XX{int ydata;public:YY(int m=0,int n=O):XX(m),ydata(n){}};YY类的对象包含的数据成员的个数是A.1B.2C.3D.4
有如下程序:includeusing namespace std;class XX{protected;int k;public:XX(int n= 有如下程序: #include<iostream> using namespace std; class XX{ protected; int k; public: XX(int n=5):k(n){} ~XX(){cout<<"XX";} Virtual void f()cons=0; }; inline void XX::f()const{cout<<k+3;} class YY:public XX{ public:A.28XXB.28YYXXC.-33XXD.-33XXYY
有如下类定义:class XX{int XX;public:xx():xx(0){toutA;}XX(int n):xx(n){coutB;}};class Y:Y:public XX{int YY;public:YY():YV(O){coutYY;)YY(int n):xx(n+1),YY(n){coutYY;}YY(int m,int n):XX(m),YY(n){coutyy;)};下列选项中,输出结果为A0的语句是A.YY yl(0,0);B.YY 72(1);C.YY y3(0);D.YY y4;
有如下类定义:classXX{intxdata;public:XX(intn=0):xdata(n){}};classYY:publicXX{intydata;public:YY(intm=0,intn=O):XX(m),ydata(n){}};YY类的对象包含的数据成员的个数是( )。A.1B.2C.3D.4
有如下程序:includeusingnamespacestd;classXX{protected: intk;public: XX(intn=5): 有如下程序: #include <iostream> using namespace std; class XX { protected: int k; public: XX(int n=5):k(n){} ~XX() { cout<<"XX"; } virtual void f() const=0; }; inline void XX::f()A.28XXB.28YYXXC.-33XXD.-33XXYY
阅读下列说明和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;}