阅读该程序,给出程序的输出结果。
#include <iostream.h>
class A
{
public:
virtual void fun()
{
cout<<"A::fun() called.\n";
}
};
class B:public A
{
void fun()
{
cout<<"B::fun() called.\n";
}
};
void ffun(A *pa)
{
pa->fun();
}
void main()
{
A *pa=new A;
ffun(pa);
B *pb=new B;
ffun(pb);
}