Do class methods increase the size of the class instances?

后端 未结 4 1176
鱼传尺愫
鱼传尺愫 2020-12-14 00:40

The question is pretty straight forward. For clarity, consider the example below:

// Note that none of the class have any data members
// Or if they do have          


        
4条回答
  •  春和景丽
    2020-12-14 01:25

    Yes they will. Actually in your case the size will be 1. In C++ a class even without any data member will have a size of 1.

提交回复
热议问题