35

单选题 35 /40

如下程序:
#include "stdio.h"
class Base
{
public:
    Base()
    {
        Init();
    }
    virtual void Init()
    {
        printf("Base Init\n");
    }
    void func()
    {
        printf("Base func\n");
    }
};
class Derived: public Base
{
public:
    virtual void Init()
    {
        printf("Derived Init\n");
    }
    void func()
    {
        printf("Derived func\n");
    }
};

int main()
{
    Derived d;
    ((Base *)&d)->func();
    
    return 0;
}
该程序的执行结果

参考答案

Base Init Derived func
Base Init Base func
Derived Init Base func
Derived Init Derived func