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

前端 未结 4 1058
梦谈多话
梦谈多话 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:39

    An Empty class inheriting a base class in virtual (access specifier ) mode (ex.virtual public) has size of 8 while if is non-empty it would have a size of 16.

提交回复
热议问题