Can someone please explain traits in Scala? What are the advantages of traits over extending an abstract class?
Similar to interfaces in Java, traits are used to define object types by specifying the signature of the supported methods.
Unlike Java, Scala allows traits to be partially implemented; i.e. it is possible to define default implementations for some methods.
In contrast to classes, traits may not have constructor parameters. Traits are like classes, but which define an interface of functions and fields that classes can supply concrete values and implementations.
Traits can inherit from other traits or from classes.