打印派生类Son的层次:
reference:
vs2015开发人员命令提示工具 查看C++类对象模型
https://blog.csdn.net/qq_29542611/article/details/79504396
VS2013可能会提示 :
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337) : warning C4530: 使用了 C++ 异常处理程序,但未启用展开语义。请指定 /EHsc
C:\Users\****\Documents\Visual Studio 2013\Projects\1.0 C++ fill\02 C++ virtual>cl /d1 reportSingleClassLayoutCat main.cpp -GX
用于 x86 的 Microsoft (R) C/C++ 优化编译器 18.00.21005.1 版版权所有(C) Microsoft Corporation。 保留所有权利。
cl: 命令行 warning D9035 :“GX”选项已否决,并将在将来的版本中移除
cl: 命令行 warning D9036 :使用“EHsc”而不使用“GX”
C:\Users\****\Documents\Visual Studio 2013\Projects\1.0 C++ fill\02 C++ virtual>cl /d1 reportSingleClassLayoutCat main.cpp -EHsc
用于 x86 的 Microsoft (R) C/C++ 优化编译器 18.00.21005.1 版版权所有(C) Microsoft Corporation。 保留所有权利。
main.cpp
class Cat size(4):
+---
| +--- (base class Animal)
0 | | {vfptr}
| +---
+---
Cat::$vftable@:
| &Cat_meta
| 0
0 | &Cat::speak
1 | &Cat::eat
Cat::speak this adjustor: 0
Cat::eat this adjustor: 0
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
C:\Users\OliverKing\Documents\Visual Studio 2013\Projects\1.0 C++ fill\02 C++ virtual>