Study and analysis on underlying mechanism of virtual function in C
WU Li-xian · Jisuanji gongcheng yu sheji · 2008
Polymorphism is one of the most characteristic properties of C++.Dynamic binding is an important approach to actualize polymorphism in C++,and its foundation is virtual function.The underlying mechanism of virtual function in C++ is analyzed with di-sassembling.According to different kinds of inheritance relationship,the underlying model of virtual function is presented.The extra cost of virtual function calls is given,and its influence on function call is discussed through examples.Finally,some strategies are put forward to utilize effectively virtual function.