joesan
joesan

Reputation: 15345

Scala traits stacking

I have the following traits:

trait A
trait B extends A
trait C extends B

I have to now stack these traits:

trait Stackable extends C

Is B and A automatically stacked in Stackable? or should I explicitly stack them using with?

Upvotes: 0

Views: 60

Answers (1)

Dylan
Dylan

Reputation: 13859

Yes, Stackable will extend/mixin C, B, and A

It's not necessarily wrong to explicitly mention them, i.e. trait stackable extends C with A; this won't cause any problems, but it's unnecessary. Ultimately it's up to you and your judgement to decide whether it makes sense to call them out explicitly.

Upvotes: 2

Related Questions