This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a short recipe, Recipe 8.3, “How to use a Scala trait like an abstract class.”
You want to use a trait as something like an
abstract class in Java.
Define methods in your trait just like regular Scala methods. In the class that extends the trait, you can override those methods or use them as they are defined in the trait.