对象内存布局 (7)
来源:互联网 发布:mysql decimal 加法 编辑:程序博客网 时间:2024/05/02 00:22
前篇:http://blog.csdn.net/pathuang68/archive/2009/04/23/4102002.aspx
在对象内存布局 (5)的代码中,在Derived类中覆盖Base1中声明的vfBase1_1(),其他代码不变。修改后的Derived的定义如下:
class Derived : public Base1, public Base2, public Base3
{
public:
int m_derived;
inline virtual void fd()
{
cout << "This is in Derived::fd()" << endl;
}
inline void vfBase1_1()
{
cout << "This is in Derived::vfBase1_1()" << endl;
}
};
运行结果如下:
Derived对象值memory layout图解如下:
我们可以看到,在Derived中overriden的虚函数Derived::vfBase1_1排在第一个虚函数表的第一位。虚函数Base::vfBase1_1()由于已经被overridden,所以在Derived对象的虚函数表中不再出现。
后篇:http://blog.csdn.net/pathuang68/archive/2009/04/23/4102006.aspx
- 对象内存布局 (7)
- 对象内存布局 (7)
- 对象内存布局 (7)
- C++内存对象布局
- c++对象,内存布局
- c++对象内存布局
- 对象内存布局 (1)
- 对象内存布局 (2)
- 对象内存布局 (3)
- 对象内存布局 (4)
- 对象内存布局 (5)
- 对象内存布局 (6)
- 对象内存布局 (8)
- 对象内存布局 (9)
- 对象内存布局 (10)
- 对象内存布局 (11)
- 对象内存布局 (12)
- 对象内存布局 (13)
- 关于Java中类加载时对其属性和代码块初始化顺序的研究与测试
- Strust2 I18N 国际化
- 对象内存布局 (5)
- 怀念穆大叔
- 对象内存布局 (6)
- 对象内存布局 (7)
- JavaScript中如何选中下拉框的文本
- 对象内存布局 (8)
- minimal number of exchange operations (file)
- 珍惜友谊
- 又见调试派
- string to number code in C++ template
- Open Device(Hard Drive, CD/DVD) or a device from its mount point
- 庆祝CSDN的个人博客访问量排名进入50名