Scala Book

Scala Traits and Abstract Classes

Language

Scala traits are a great feature of the language. As you’ll see in the following lessons, you can use them just like a Java interface, and you can also use them like abstract classes that have real methods. Scala classes can also extend and β€œmix in” multiple traits.

Scala also has the concept of an abstract class, and we’ll show when you should use an abstract class instead of a trait.

Contributors to this page: