# Putting Objects Together

Putting Objects Together: Inheritance and Composition: Is-a and Has-a, Delegation: Handing the Job On, Functions as Values.

Updated: November 17, 2026

1. [Inheritance and Composition: Is-a and Has-a](https://www.ask-codey.com/lessons/dp-inheritance-and-composition) (Apprentice): Two ways to build a class from another: inheritance, where an e-bike is a bike and overrides its price, and composition, where a bike has a lock it keeps as a field; saying the relationship aloud, is-a or has-a, tells you which one fits.
2. [Delegation: Handing the Job On](https://www.ask-codey.com/lessons/dp-delegation) (Apprentice): When every screen reaches through a rental to price its bike, a new rule such as a $2 helmet has to be added everywhere, and one place is missed; delegation gives the rental its own price() that hands the bike's part on to the bike, the move half the design patterns are built from.
3. [Functions as Values](https://www.ask-codey.com/lessons/dp-functions-as-values) (Apprentice): A weekend discount as a true/false flag means the total's code changes with every new deal; functions as values let the caller hand in the rule instead: a function stored in a variable, passed to another function, or made and returned by one, in C#, Java, Python, JavaScript and TypeScript.

Source: https://www.ask-codey.com/courses/design-patterns/topics/dp-putting-objects-together
