这个相对简单,只需要考虑类对象大小的累加和内存对齐
#include<iostream>
using namespace std;
class Base {
public:
int ma;
int mb;
char mc;
};
class Derive :public Base
{
public:
int md;
};
class Derive2 :public Derive
{
public:
int me;
};
int main()
{
return 0;
}

这个相对简单,只需要考虑类对象大小的累加和内存对齐
#include<iostream>
using namespace std;
class Base {
public:
int ma;
int mb;
char mc;
};
class Derive :public Base
{
public:
int md;
};
class Derive2 :public Derive
{
public:
int me;
};
int main()
{
return 0;
}

1633
8577
2709
3万+

被折叠的 条评论
为什么被折叠?