TITLE: what use multiple inheritance? (Newsgroups: comp.lang.c++.moderated, 27 Apr 98) RUDOLPH: "Chris Rudolph" > > Q: When should you use multiple inheritance? > > A: There are three acceptable answers: "Never," "Rarely," and "When the > > problem domain cannot be accurately modeled any other way." MCNAMEE: Paul McNamee > My favorite quote on this obviously religious issue, is by Grady > Booch, "Object Oriented Design with Applications", Benjamin Cummings, > 1991, page 111. > > "In our experience, we find multiple inheritance to be like a > parachute: you don't always need it, but when you do, you're really > glad to have it on hand." MARTIN: "Robert C. Martin" I would have thought, by now, the controversy over MI would have settled down. MI is most useful in statically typed languages like C++ and Java for the purpose of separating the interface of a class into distinct client specific interfaces. This decouples the clients from each other. If class A and B both use class C, but use different methods of C, then when A needs a change made in C, B will be affected. If, however, A uses an interface named AI and B uses an interface named BI, and C multiply inherits from AI and BI, then when A needs a change, AI will change and C will change but BI and B will remain unaffected. See "The Interface Segregation Principle" in the 'publications' section of my website.