有如下程序:#include using namespace std;class base{public:base(int x=0){cout<
查看答案
有如下程序:#includeusing namespace std;class Base{protected:Base(){cout<<'A';}Base(char c){cout<
A. B
B. AB
C. BA
D. BB
A. 10,20
B. 20,30
C. 30,40
D. 50,50
有如下程序:#include using namespace std:class B{public:virtual void show(){cout<<'b';}};class D:public B {public:void show(){cout<<'D';}};void fun1(B*ptr){ptr->show();}void fun2(B &ref){ref.show();}void fun3(B b){b.show();}int main(){B b,*p=new D;D d;fun1(p);fun2(b);fun3(d);return 0;}程序的输出结果是()。
A. BDD
BBD
C. DBB
DBD
有如下程序:#includeusing namespace std;class A{public:virtual void func1(){cout<<"A1";}void func2(){cout<<"A2";}};class B:public A{public:void func1(){cout<<"B1";}void func2(){cout<<"B2";}};int main(){A*p=new B;p->func1();p->func2();delete p;return 0;}运行时的输出结果是()。
A1B2
B1A2
C. B1B2
D. A1A2