28: Composition. The Has-A Relationship.
Dec 29, 2015•9 min
Episode description
Composition allows you to specify very different kinds of relationships between classes. This is sometimes also called containment. If you are building a racing game and have a car class and a wheel class, you would not want to say that cars are wheels but instead that cars have wheels. Proper use of composition will even allow you to substitute what kind of wheels your cars have. This can not only simplify your designs but make your code easier to test.
For the best experience, listen in Metacast app for iOS or Android
