如果不能使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问从基数继承的成员,下列程序没有使用多态机制,其输出结果是______。
#include<iostream>
using namespaee std;
class Base
public:
void print( )tout<<’B’;
class Derived:publie Base
public:
void print( )tout<<’D’;
int main( )
Derived*pd=new Derived( );
Base*pb=pd:
pb->print( );
pd->print( );
delete pd;
return 0;