Composition vs inheritance: a product catalogue
Build values from small, swappable parts instead of a chain of embedded structs.
Level Beginner
What you will see
- Many kinds of products
- A family tree made of embedded structs
- One new idea, twice the types
- A product made of parts
- Asking the parts
- When embedding is the right choice
Before / after
Base: composition-over-inheritance-base-goView the diff