How to create an objectthat extends a trait and uses early definition syntax?
Let's say we have two traits:
trait Trait {
val value : String
}
trait Simple
Let's say we have also a simple class:
class Class
We can create a new object of type Class
and make it extend a Simple
trait:
new Class extends Simple
Is it possible to create a new object of type Class
that extends the Trait
and uses the early definition syntax to set value
member? I tried something like:
new Class extends { override val value = "42" } with Trait
But this gives a syntax error:
Error:(12, 17) ';' expected but 'extends' found.
new Class extends { val value = "42" } with Trait