object Lessons
1.C++中布局以及存取时间上的的额外负担是由virtual引起的:virtual function、virtual base class。或是由于多继承引起的。
2.C++中有2种class membe:static,non-staticr和三种member function:static,non-static,virtual。不同的对象模型在内
存中对这些元素有不同的表现方式。
a.简单对象模型
以solt方式保存对象成员。
b.表格驱动对象模型
每个对象都是2个指针大小,一个指向data member table,一个指向member function table
c.C++对象模型
没有继承的情况:
加上继承的情况:
在没有虚基类的情况下,C++是直接把基类的subobject和子类的object存储在一起的。如果有了虚基类,
则会引入虚基类表格。[详细请见后续3.5节]