Replace Inheritance with Delegation

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m
Line 9: Line 9:
 
*[[Delegation]]
 
*[[Delegation]]
 
*[[Don't burn your base class]]
 
*[[Don't burn your base class]]
 +
*[[Avoid inheritance for implementation]]

Revision as of 07:21, 7 October 2010

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."

See Also

Personal tools