"vbtl在构造函数调用后才建立"我对最后一个回答有点疑问 《深入C++对象模型》里有提到: How might the table containing the virtual function addresses be constructed? In C++, the set of virtual functions capable of being invoked through an object of its class is known at compile time. Moreover, this set is invariant. It cannot be added to nor can a virtual instance be replaced at runtime. The table, therefore, serves only as a passive repository. Since neither its size nor its contents change during program execution, its construction and access can be completely handled by the compiler. No runtime intervention is necessary. 虚表应该是一个编译器行为,在编译的时候就已经创建了
1

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务