Morgan Cheng wrote:
It seems no pattern defined by GoF takes advantage of multiple
inheritance. I am wondering if there is a situation where multiple
inheritance is a necessary solution.
There is no situation where mutiple inheritance is *necessary*.
Of course, there is also no situation where inhertiance is
*necessary*. After all, everything we can do with C++ can also
be done with a Turing machine and there is no such thing as
inheritance there.
When coding in C++, should multiple inheritance still be avoided?
Inheritance should be avoided (note the deliberate absence of
"multiple"). You should use inheritance only when it makes your
design simpler. If multiple inheritance makes your design
simpler, you should use multiple inheritance. ... and, yes,
there are indeed some situations where inheritance is the
right way to go. The same applies to multiple inheritance. Just
because the GoF does not use them does not mean that it's
useless.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting