欢迎来到牛牛题库网 牛牛题库官网
logo

单项选择题

有如下程序:
#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
点击查看答案&解析
微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题