Favor the following over inheritance

Delegation
When you hand over the responsibility for a particular task to another class or method.
Composition
Use behavior from a family of other classes, and change that behavior at runtime.
Aggregation
When one class is used as part of another class, but still exists outside of that other class.
Comments