Rust favors composition over inheritance.
I’m sure you’ve heard that before, but rarely does anyone take the time to explain what it means in practice.
Also, why is this model the right choice for Rust?
Let’s take a step back and look at an example: …
And it even manages to take the good stuff from object oriented programming, like RAII and encapsulation and interfaces without getting in the weeds with inheritance!
And it even manages to take the good stuff from object oriented programming, like RAII and encapsulation and interfaces without getting in the weeds with inheritance!