这个例子的性能和纯虚函数表例子是相同的。
The performance of this sample and the pure vtable-based sample are exactly identical.
编译器用正确的函数地址初始化这些虚函数表。
The compiler initializes these tables with the correct function addresses.
内存开销非常小:基本上每个接口需要额外4个字节(对象实例数据里虚函数表指针),加上引用计数的4个字节。
Overhead in memory is very small: You basically have a 4- byte overhead per interface (the vtable pointers in the object's instance data) plus 4 bytes for the reference counter.
内存开销非常小:基本上每个接口需要额外4个字节(对象实例数据里虚函数表指针),加上引用计数的4个字节。
Overhead in memory is very small: You basically have a 4- byte overhead per interface (the vtable pointers in the object's instance data) plus 4 bytes for the reference counter.
应用推荐