首先,Vee - Table指针用于访问虚函数,而对数据成员的访问直接使用编译时偏移量实现。
First, the Vee-Table pointer is used to access virtual functions, and data members are accessed directly using compile time offsets.
如果函数是虚函数,并且调用是通过引用或者指针,编译器基于动态类型生成代码确定调用哪个版本。
If the function is virtual and the call is through a reference or pointer, then the compiler generates code to determine which version to run based on the dynamic type of the object.
当你通过基类的指针来调用虚函数,技术也是一样的。
When you invoke calls through a pointer to the base class, the technique is the same.
应用推荐