how to determine the size of virtual base class and derived classes from it?

前端 未结 4 1076
梦谈多话
梦谈多话 2021-01-05 12:53
#include 
using namespace std;

class base1{};
class base2{virtual void show(){}};

class test1{    };
class test2{virtual void show(){}};

class der         


        
4条回答
  •  感情败类
    2021-01-05 13:42

    My old paper "C++: Under the Hood" explains the Microsoft C++ implementation of virtual base classes. http://www.openrce.org/articles/files/jangrayhood.pdf

    And you can compile with cl /d1reportAllClassLayout to get a text report of class memory layouts.

    Happy hacking!

提交回复
热议问题