14

单选题 14 /40

写出下面程序的输出结果
class A
{
public:
 void FuncA()
 {
     printf( "FuncA called\n" );
 }
 virtual void FuncB()
 {
     printf( "FuncB called\n" );
 }
};
class B : public A
{
public:
 void FuncA()
 {
     A::FuncA();
     printf( "FuncAB called\n" );
 }
 virtual void FuncB()
 {
     printf( "FuncBB called\n" );
 }
};
void main( void )
{
 B	b;
 A	*pa;
 pa = &b;
 A *pa2 = new A;
 pa->FuncA(); ( 3) 
 pa->FuncB(); ( 4)
 pa2->FuncA(); ( 5)
 pa2->FuncB();
 delete pa2;
}

参考答案

FuncA called FuncB called FuncA called FuncB called
FuncA called FuncBB called FuncA called FuncB called
FuncA called FuncBB called FuncAB called FuncBB called
FuncAB called FuncBB called FuncA called FuncB called