The error is
class C inherits conflicting members:
def func(): Unit (defined in trait A) and
def func(): Unit (defined in trait B)
(note: this can be resolved by declaring an `override` in class C.)
You can override the member as the error message suggests:
class C extends A with B {
override def func(): Unit = super[A].func() // Inside trait A
}
or
class C extends A with B {
override def func(): Unit = super[B].func() // Inside trait B
}
If you don't specify any parent trait in super[...]
then the choice of method implementation will depend on the order of parents:
class C extends A with B {
override def func(): Unit = super.func() // Inside trait B
}
or
class C extends B with A {
override def func(): Unit = super.func() // Inside trait A
}
Linearization order in Scala
Scala stackable traits