Really appreciate a conceptual explanation.
Virtual inheritance is implemented in different way depending on the compiler.
1) Yes, both vc and gcc use vTable pointer. But vc has another pointer ref as virtual base pointer.
2) For a classical virtual inheritance, like Left < Top; Right < Top; Bottom < Left and Right The stack should be like this:
Left.vptr // -> to its vtable
Left::element_in_left
Right.vptr
Right::element_in_right
Bottom::element_in_bottom
Top::element_in_top
Programs use vptr to find vtable, for gcc, there is a virtual base offset value in viable. vptr + base offset will give the parent address.
3) I'm not sure what do you mean. There are different ways to implement it in C++ compilers. And other languages have their ways to bind functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With