虚拟表在内存中的布局? [英] Virtual Table layout in memory?

查看:67
本文介绍了虚拟表在内存中的布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虚拟表如何存储在内存中?他们的布局?

how are virtual tables stored in memory? their layout?

例如

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

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

A类和B类虚拟表在内存中的布局如何?

How will be the layout of virtual tables of class A and class B in memory?

推荐答案

正如其他人所说,这是依赖于编译器的,而不是您日常使用C ++时真正需要考虑的内容.但是,如果您只是对此问题感到好奇,则应该阅读Stan Lippman的书在C ++对象模型内部.

As others have said, this is compiler dependant, and not something that you ever really need to think about in day-to-day use of C++. However, if you are simply curious about the issue, you should read Stan Lippman's book Inside the C++ Object Model.

这篇关于虚拟表在内存中的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆