This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 8.4, “How to use Scala traits as simple mixins (or, How to mix in Scala traits).”
You want to design a solution where multiple traits can be mixed into a class to provide a robust design.
To implement a simple mixin, define the methods you want in your trait, then add the trait to your class using
with. For instance, the following code defines a