# Class composition (vs inheritance)

TODO: ADD MORE

- adding functionality from a class by incorporating an instance of that class in a class you are creating. The example creates a `robot` by instantiating a `compass` and assigning it to the `self`.compass attribute of `robot`. [robot-simulator](../exercise-concepts/robot-simulator.md)
