C++ : How can I know the size of Base class SubObject?

后端 未结 3 1258
眼角桃花
眼角桃花 2020-12-19 19:08

.

Here I was discussing Empty Base Optimization, and MSalters made this interesting comment:

No class can ever have sizeof(Class)==0, empty

3条回答
  •  一个人的身影
    2020-12-19 19:56

    You can't. The actually size might differ a lot from the sizeof() information when serving as a base.

    One other example than EBO is virtual inheritance.

提交回复
热议问题