How are objects stored in memory in C++?

前端 未结 5 1525
無奈伤痛
無奈伤痛 2020-12-03 02:18

How are objects stored in memory in C++?

For a regular class such as

class Object
    {
public:
    int i1;
    int i2;
    char i3;
    int i4;
pri         


        
5条回答
  •  星月不相逢
    2020-12-03 02:49

    Usually what matters isn't whether the class has a constructor: what matters is whether the class has any virtual methods. For details, google for 'vtable' and 'vptr'.

提交回复
热议问题