The knowledge point is to read the blog of Chen Hao's eldest brother, and his code is also referenced, but a small change has been made.
Link: http://blog.csdn.net/haoel/article/details/1948051
# Include "stdio. H "class base {public: Virtual void fun1 () {printf (" Call base fun1 \ n ");} virtual void fun2 () {printf ("Call base fun2 \ n");} virtual void fun3 () {printf ("Call base fun3 \ n");} PRIVATE: Virtual void fun4 () {printf ("Call base fun4 \ n") ;}}; class derived: public base {public: Virtual void fun1 () {printf ("Call derived fun1 \ n");} virtual void fun5 () {printf ("Call fun5 \ n") ;}}; typedef void (* Fun) (void); void main (void) {derived lderived; int ** lpvtableadd = (INT **) & lderived; For (INT I = 0; I <5; ++ I) {fun lpfun = (fun) (lpvtableadd [0] [I]); lpfun () ;}printf ("first add of base: % d, and first virtual fun Add: % d \ n ", (int *) (& lderived), & lpvtableadd );}
After reading the code, you should be clear about the virtual function table, O (partition _ tables) O ~