AlgoViz

Object composition

medium 50 min

Build a big object from small ones.

Chapter mnemonic

Three object relationships

A car is a vehicle, owns its engine, and uses a charger.

A car borrows a public charger for five minutes. Which relationship fits?

Dependency. The car uses the charger for an operation and does not own its lifecycle.