⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠

Text Elements

class Animal { public: virtual void speak() {cout << “动物在说话” << endl;} };

vfptr - 虚函数指针 v - virtual f - function ptr - pointer

Animal 内部结构 vfptr

vftable

vftable - 虚函数表 v - virtual f - function table - table

&Animal::speak

class Cat:public Animal { public: virtual void speak() {cout << “小猫在说话” << endl;} };

Cat 内部结构重写Animal之后 vfptr

vftable

&Cat::speak

Embedded files

0e79c74740a2ce26c3070c8007fb1928a4203136: 4b9af544de6ca83bebe9f4c04965f89600c97621: