Open In App

Scala | Trait Mixins

We can extend several number of scala traits with a class or an abstract class that is known to be trait Mixins. It is worth knowing that only traits or blend of traits and class or blend of traits and abstract class can be extended by us. It is even compulsory here to maintain the sequence of trait Mixins or else the compiler will throw an error.
Note:

  1. The Mixins traits are utilized in composing a class.
  2. A Class can hardly have a single super-class, but it can have numerous trait Mixins. The super-class and the trait Mixins might have identical super-types.

Now, lets see some examples.




Article Tags :