一游戏公司面试题,回答出正确结果得20分.
//分享某个游戏公司面试题//看代码写结果,并回答为什么得出这样的结果?
#include <iostream>
using namespace std;
class Person
{
public:
virtual void func()
{
}
private:
int a;
int b;
};
class Writer : public Person
{
public:
void func()
{
}
private:
int c;
int d;
};
int main()
{
Writer writer;
cout << sizeof(Person) << endl;
cout << sizeof(Writer) << endl;
return 0;
}
页:
[1]