( 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;

( 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 ) {cout<<yy;}

YY ( int m, int n ) : XX ( m ) , yy ( n ) {cout<<yy;}

};

下列选项中,输出结果为 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

在C中,如果需要把字符串型的量xx转化为整型的量yy,可以使用的语句是()。 A.intyy=(int)xx;B.intyy=xx.ToString();C.intyy=Convert.ToInt32(xx);D.intyy=xx.ToInt32(xx);

有如下类定义: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

有如下类定义: 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

有如下程序: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