有如下程序: #include<iostream> usingnamespacestd; classCon charID; public: Con():ID(A){cout<<1;} Con(charID):ID(ID){eout<<2;} Con(Con&c):ID(c.getID()){cout<<3;} chargetID()corlst{returnID;} }; voidshow(Conc)(cout<<C.getID();} intmain() { Conc1:
show(c1); Conc2(B); show(c2); return0; } 执行上面程序的输出是( )。
A.13A23A
B.23A13B
C.13A23B
D.13823A
第1题:
有如下程序: #include<iostream> using namespace std; classA { public: A(){cout<<"A";} }; class B{public:B(){cout<<"B";}}; class C:public A { B b; public: C(){cout<<"C";} }; int main(){C obj;return 0;} 执行后的输出结果是( )
A.ABC
B.BAC
C.ACB
D.CBA
第2题:
有如下程序:
include <iostream>
using namespace std;
class PARENT
{
public:
PARENT() { cout <<"PARENT"; }
};
class SON : public PARENT
{
public:
SON() {cout << "SON"; }
};
int main()
{
SON son;
PARENT *p;
p = &son;
return 0;
}
执行上面程序的输出是______。
第3题:
有如下程序: #include(iostream> usingnamespacestd; classCon { charID; public: Con( ):ID('A){cout<<1;} Con(charID):ID(ID){cout((2;) Con(Con8Lc):ID(c.getlD( )){cout<<3;} chargetID( )const{returnID;} }; voidshow(Conc){cout<<C.getlD( );} intmain( ) { Conc1; show(c1); Conc2('B'); show(c2); return0; 执行上面程序的输出结果是( )。
A.13A23A
B.23A13B
C.13A23B
D.13823A
第4题:
有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE( ){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED( ){cout<<"DERIVED";} }; int main( ){DERIVED x;return 0;} 程序的输出结果是
A.BASE
B.DERIVED
C.BASEDERIVED
D.DERIVEDBASE
第5题:
有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; cla
A.AA
B.AABBCC
C.BBAABBCC
D.BBBBAACC