Replace Inheritance with Delegation
From CSSEMediaWiki
(Difference between revisions)
m |
|||
Line 7: | Line 7: | ||
==See Also== | ==See Also== | ||
− | [[Don't burn your base class]] | + | *[[Delegation]] |
+ | *[[Don't burn your base class]] |
Revision as of 11:54, 14 September 2009
Straight from Martin Fowler 1999:
"A subclass uses only part of a superclasses interface or does not want to inherit data.
Create a field for the superclass, adjust methods to delegate to the super class, and remove the subclassing."