有如下程序:#include<iostream>using namespace std;class B{public:virtual void show(){cout<
有如下程序: #include<iostream> using namespace std; class B{ public: virtual void show(){cout<<"B";} }; class D:public B{ public: void show(){cout<<"D";} }; void funl(B*ptr){ptr->show();} void fun2(B&ref);ref.show();} void fun3(B b){b.show();} int nlain(){ B b,*P=Dew D; D d; funl(p); fun2(b); fun3(d); return 0; } 程序的输出结果是
A.BBB
B.BBD
C.DBB
D.DBD