E
emma middlebrook
Hi
I come from a C++ background and so am familiar with the 'dreaded
inheritance diamond' i.e. the ambiguity of which data to use when a
class appears twice in the hierarchy. Here's a link for anyone not
familiar: http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.8
..
Base
/ \
/ \
/ \
Der1 Der2
\ /
\ /
\ /
Join
Now to my question ... I know an interface inheritance hierarchy of
the same configuration doesn't suffer any problems at all but, to me,
seeing it in a class diagram still makes me feel a little queasy from
a design correctness point-of-view. If anyone feels the same, how do
they best get round the problem. If you don't feel queasy, would you
tell me why I shouldn't either!
Finally, in my particular case I have interfaces IBase and IDerived
(the latter derived from the former), Concrete deriving from IBase,
and then DerivedConcrete deriving from both Concrete and IDerived.
Hence the diamond.
IBase
/ \
/ \
/ \
IDerived Concrete
\ /
\ /
\ /
DerivedConcrete
Thanks very much for your help!
Emma Middlebrook
(e-mail address removed)
I come from a C++ background and so am familiar with the 'dreaded
inheritance diamond' i.e. the ambiguity of which data to use when a
class appears twice in the hierarchy. Here's a link for anyone not
familiar: http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.8
..
Base
/ \
/ \
/ \
Der1 Der2
\ /
\ /
\ /
Join
Now to my question ... I know an interface inheritance hierarchy of
the same configuration doesn't suffer any problems at all but, to me,
seeing it in a class diagram still makes me feel a little queasy from
a design correctness point-of-view. If anyone feels the same, how do
they best get round the problem. If you don't feel queasy, would you
tell me why I shouldn't either!
Finally, in my particular case I have interfaces IBase and IDerived
(the latter derived from the former), Concrete deriving from IBase,
and then DerivedConcrete deriving from both Concrete and IDerived.
Hence the diamond.
IBase
/ \
/ \
/ \
IDerived Concrete
\ /
\ /
\ /
DerivedConcrete
Thanks very much for your help!
Emma Middlebrook
(e-mail address removed)