Virtual Table layout in memory?

后端 未结 6 1652
陌清茗
陌清茗 2021-02-08 13:11

how are virtual tables stored in memory? their layout?

e.g.

class A{
    public:
         virtual void doSomeWork();
};

class B : public A{
    public:         


        
6条回答
  •  佛祖请我去吃肉
    2021-02-08 13:46

    From wikipedia:

    The C++ standards do not mandate exactly how dynamic dispatch must be implemented

    So the answer is no. Layout of vtable is implementation defined.

提交回复
热议问题