class Base { public: int a; int b; virtual void function(){} virtual void function001(){}
Base(){} void NotVirtFunc(){} };
class Derive : public Base { public: Derive(){} int c; virtual void function(){} virtual void function006(){} };
class Test { public: int vv; virtual void bar(){} virtual void foo(){}
Test(){} };
class Derive2 : public Derive, public Test { public: Derive2(){} int d2; virtual void function(){} virtual void function006(){} virtual void bar(){} };
(gdb) p b $1 = {_vptr.Base = 0x400a90 <vtable for Base+16>, a = 0, b = 0} (gdb) info vtbl b vtable for 'Base' @ 0x400a90 (subobject @ 0x7fffffffe2e0): [0]: 0x40081e <Base::function()> [1]: 0x400828 <Base::function001()>
1 2 3 4 5 6 7
(gdb) p d $2 = {<Base> = {_vptr.Base = 0x400a50 <vtable for Derive+16>, a = 0, b = 0}, c = 1} (gdb) info vtbl d vtable for 'Derive' @ 0x400a50 (subobject @ 0x7fffffffe2c0): [0]: 0x40086e <Derive::function()> [1]: 0x400828 <Base::function001()> [2]: 0x400878 <Derive::function006()>
1 2 3 4 5 6 7 8 9 10 11 12 13
(gdb) p *d2 $5 = {<Derive> = {<Base> = {_vptr.Base = 0x4009d0 <vtable for Derive2+16>, a = 0, b = 0}, c = 0}, <Test> = {_vptr.Test = 0x400a00 <vtable for Derive2+64>, vv = 0}, d2 = 0} (gdb) info vtbl d2 vtable for 'Derive2' @ 0x4009d0 (subobject @ 0x603010): [0]: 0x4008ee <Derive2::function()> [1]: 0x400828 <Base::function001()> [2]: 0x4008f8 <Derive2::function006()> [3]: 0x400902 <Derive2::bar()>
vtable for 'Test' @ 0x400a00 (subobject @ 0x603028): [0]: 0x40090c <non-virtual thunk to Derive2::bar()> [1]: 0x40088c <Test::foo()>