Size of C++ classes

前端 未结 3 1449
予麋鹿
予麋鹿 2021-02-07 12:06

Here is the code which prints size of different classes

#include 

using namespace std;

class EmptyClass
{    
};

class AbstractClass
{
  publi         


        
3条回答
  •  攒了一身酷
    2021-02-07 12:40

    NotAbstrClass is like an empty class when we talk about bit sizes since it has no data. MixClass has the virtual function pointer (4 bytes on a 32-bit machine) and an int (also 4 bytes).

提交回复
热议问题