class Person
{
private:
int age;
char sex;
};
class Student: public Person
{
private:
int cid;
};
> cl /d1 reportSingleClassLayoutStudent D:\ConsoleApplication1\student.cpp
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.31.31104 版
版权所有(C) Microsoft Corporation。保留所有权利。
student.cpp
class Student size(12):
+---
0 | +--- (base class Person)
0 | | age
4 | | sex
| | <alignment member> (size=3)
| +---
8 | cid
+---
Microsoft (R) Incremental Linker Version 14.31.31104.0
Copyright (C) Microsoft Corporation. All rights reserved.