In kotlin there is 'Decorate by Delegation' pattern. Is there a way to achieve it in an elegant way in Scala.
Here is a kotlin code example:
interface Doo{
fun a(): Unit
fun b(): Unit
}
class Goo:Doo {
override fun a() {
println("goo a")
}
override fun b() {
println("goo b")
}
}
class Moo(doo: Doo):Doo by doo{
override fun b() {
println("mooooooo")
}
}
fun main() {
val m = Moo(Goo())
m.a();m.b()
}