有如下程序: #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
第1题:
有如下程序: #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
第2题:
有如下程序: #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.XY
B.YX
C.X
D.Y
第3题:
有如下程序: #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
第4题:
有如下程序:
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;
}
执行上面程序的输出是______。
第5题:
有如下程序: #include <iostream> using namespace std; Class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<
A.1
B.123
C.242
D.244