29

单选题 29 /40

在32位操作系统gcc编译器环境下,下面程序的运行结果为()
#include <iostream>
using namespace std;
class A {
public:
    int b;
    char c;
    virtual void print() {
        cout << "this is father’s fuction! " << endl;
    }
};
class B: A {
public:
    virtual void print() {
        cout << "this is children’s fuction! " << endl;
    }
};
int main(int argc, char * argv[]) {
    cout << sizeof(A) << "" << sizeof(B) << endl;
    return 0;
}

参考答案

12 12
8 8
9 9
12 16