Avoid multiple inheritance
From CSSEMediaWiki
(Difference between revisions)
WarwickIrwin (Talk | contribs) (Asked a question) |
|||
Line 7: | Line 7: | ||
Interfaces can often be used instead of multiple superclasses. | Interfaces can often be used instead of multiple superclasses. | ||
+ | |||
+ | ''Why is it OK to inherit multiple interfaces, but not multiple classes?'' --[[User:Warwick Irwin|Wal]] | ||
== See also == | == See also == |
Revision as of 01:43, 23 July 2009
If you have an example of multiple inheritance in your design, assume you have made a mistake and prove otherwise. -- Riel's Heuristic 6.1, Arthur Riel 1996
Explanation
Riel believes that multiple inheritance (MI) is not evil or undesirable; however, it is rarely used correctly. If a situation exists that you believe requires multiple inheritance you should consider this carefully.
Alternatives
Interfaces can often be used instead of multiple superclasses.
Why is it OK to inherit multiple interfaces, but not multiple classes? --Wal