单选题
C++
题号 #144315
如果不使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问从基类继承的成员,有如下程序,没有使用多态机制。
#include
using namespace std;
class Base{
int a,b;
public:
Bace(int x ,int y) { a=x; b=y;}
Void show(){ cout < }
clsaa Derived:public Base {
int c ,d;
public:
Derived(int x,int y,int z,int m):Base(x,y){c=z; d=m;}
Void show(){ cout < };
int main()
{
Base B1(50,50),*pb;
Derived DI(10,20,30,40);
Pb=&D1;
Pb- >show();
Return 0;
}
运行时输出的结果是( )。
参考答案
A
答案解析
暂无解析
你可能感兴趣的试题
A.10,2
B.12,10
C.12,2
D.2,2
A.f+g+
B.f0+g+
C.f+g0+
D.f0+g0+
A.运行时输出1011
B.运行时输出1111
C.运行时输出1112
D.编译有错