Skip to content

Glossary: Software Design Patterns in Rust

Composition

Also written: composition over inheritance

Building a struct from other values it holds and hands work to ("has-a"), instead of inheriting from a parent. A Product holds a pricing part and a wrapping part.

Where the book teaches it

Related terms

InheritanceDelegationHas-a / is-a