Re: factoring book question and cast question.
Francis Glassborow wrote:
In article <1169737357.844350.235500@l53g2000cwa.googlegroups.com>,
todma <toddmarshall2002@yahoo.com> writes
I have a class derived from 2 virtual base classes.
While it is not wrong to have virtual base classes in a hierarchy it
does need real justification, and having two requires even more. They
add considerable complexity to the derived types and can result in many
surprises.
That statement surprizes me. I've worked on applications with
as many as 8 virtual base classes in a hierarchy, and it didn't
cause any problems. As a general rule, if you're inheritance is
for the typical OO reasons, you should use virtual inheritance
unless there is some very strong reason not to. (It's another
case where C++ got the default wrong: inheritance should be
virtual by default, and non-virtual only when you explicitly
say so.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientie objet/
Beratung in objektorientierter Datenverarbeitung
9 place Simard, 78210 St.-Cyr-l'Icole, France, +33 (0)1 30 23 00 34
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]