c++ Programming Glossary: vfptr
Why does this code crash at the places mentioned? http://stackoverflow.com/questions/1043402/why-does-this-code-crash-at-the-places-mentioned fine baseArray 1 .SomeFunction Crashes because of invalid vfptr baseArray 2 .SomeFunction Crashes because of invalid vfptr baseArray.. vfptr baseArray 2 .SomeFunction Crashes because of invalid vfptr baseArray 3 .SomeFunction Works fine baseArray 4 .SomeFunction.. fine baseArray 4 .SomeFunction Crashes because of invalid vfptr baseArray 5 .SomeFunction Crashes because of invalid vfptr baseArray..
c++ data alignment /member order & inheritance http://stackoverflow.com/questions/2006504/c-data-alignment-member-order-inheritance function. The memory layout for vbase would be void vfptr vbase The memory layout for vbase2 would be void vfptr vbase2.. vfptr vbase The memory layout for vbase2 would be void vfptr vbase2 The memory layout for vderived would be void vfptr vderived.. vfptr vbase2 The memory layout for vderived would be void vfptr vderived The memory layout for vderived2 would be void vfptr..
object size with virtual http://stackoverflow.com/questions/2038717/object-size-with-virtual class C size 20 base class A 0 vfptr 4 a base class B 8 vfptr 12 b 16 c You are correct there.. C size 20 base class A 0 vfptr 4 a base class B 8 vfptr 12 b 16 c You are correct there are two vtables one for each.. the layout of class B in this example class B size 20 0 vfptr 4 vbptr 8 b virtual base A 12 vfptr 16 a As you can see there..
|