TITLE: Q & A on the value of MI IC = ichudov@wiltel.com (Igor Chudov) RM = rmartin@rcmcon.com (Robert Martin), 2 Dec 94 IC: Do you use multiple inheritance in C++? RM: Yes, often. IC: Do you have any benchmarks on how much slower is access to elements of classes declared virtual? RM: I have never noticed any efficiency issues. My reading indicates that MI is no slower than normal inheritance unless there is a virtual base class, and then the difference is one pointer dereference. (i.e. not big) IC: Do you have any horror stories on how MI lead you to bad designs/ maintenance frustrations/compiler bugs? RM: No. IC: Do you have any examples when MI was absolutely necessary and useful? RM: Indeed. It is often the case where one object must respond to more than one interface, and yet those two interfaces have clients that should not know about each other. MI is the only solution for such problems. And they are very frequent. Consider, I have my own exception model. Owl has its own exception model. Owl forces you to use OWL exceptions. i.e. you must derive your exceptions from TxOwl. I don't want my modules to depend upon OWL (i.e. I don't want them in #include any owl headers). So I create my own abstract excecption class: AbstractException. I invoke an abstract factory to create AbstractException objects. Then I derive the implemented exception both from AbstractException and TxOwl. The result is that the bulk of my code remains independent of OWL even though it is using exceptions that OWL can deal with. This is not an isolated case. Such connundrums come up very frequently in OOD and MI provides a very clean solution to them.