有如下程序: #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
第1题:
有如下程序: #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
第2题:
有如下程序:
inClude<iostream>
using namespace std;
class AA
{
public:
viltual void f()
{
cout<<"AA";
}
};
class BB:public AA
{
public:
BB()
{
cout<<"BB";
}
};
class CC:public BB
{
public:
virtual void f()
{
BB::f();
cout<<"CC";
}
};
int main()
{
AA aa,*p;BB bb;CC cc;
p=&cc;
p->f();
return 0;
}
运行后的输出结果【 】。
第3题:
第4题:
有如下程序:
include<iostream>
using namespaee std;
class A{
public:
A( ){cout<<"A";}
~A( ){cout<<"A";}
};
class B{
A a;
public:
B( ){cout<<"B";}
~B( )t cout<<"B";}
};
int main( ){
B b;
return 0;
}
程序的输出结果是______。
第5题:
有如下程序: #include<iostream> using namespace std; class B{ public: Virtual void show(){cout<<“B”;} }; class D:publicB{ public: void show(){cout<<“D”;} }; void funl(B*ptr){ptr->show();} void{un2(B&ref){ref.show();} void
A.BBB
B.BBD
C.DBB
D.DBD