M
Massimo
Hi to all, I'm facing a problem in a particularly complex inheritance
hierarchy, and I'd like to know what the standard says about it and if my
compiler is correct in what it does.
I have two consecutive layers of diamond-shaped inheritance; the first layer
is declared as using virtual inheritance, while the second one is declared
as *not* using it.
This is what I'd like to have:
Base Base
/ \ / \
D1Base D2Base D1Base D2Base
\ / \ /
Middle Middle
|| ||
D1Middle D2Middle
\ /
\ /
\ /
Last
This is what the compiler actually does:
Base
/ \
D1Base D2Base
\ /
Middle
/ \
D1Middle D2Middle
\ /
Last
If I remove all virtual inheritance, everything goes just fine; if I use it
in the first layer, there seems to be no way of disabling it afterwards.
Does the standard saying anything about this, or is it
implementation-dependant? My compiler is Visual Studio 2005.
Code sample attached.
Thanks
Massimo
hierarchy, and I'd like to know what the standard says about it and if my
compiler is correct in what it does.
I have two consecutive layers of diamond-shaped inheritance; the first layer
is declared as using virtual inheritance, while the second one is declared
as *not* using it.
This is what I'd like to have:
Base Base
/ \ / \
D1Base D2Base D1Base D2Base
\ / \ /
Middle Middle
|| ||
D1Middle D2Middle
\ /
\ /
\ /
Last
This is what the compiler actually does:
Base
/ \
D1Base D2Base
\ /
Middle
/ \
D1Middle D2Middle
\ /
Last
If I remove all virtual inheritance, everything goes just fine; if I use it
in the first layer, there seems to be no way of disabling it afterwards.
Does the standard saying anything about this, or is it
implementation-dependant? My compiler is Visual Studio 2005.
Code sample attached.
Thanks
Massimo