Scala code:
trait Box {
def put(num:Int) = println("Put number: " + num)
}
trait DoubleBox extends Box {
override def put(num:Int) = super.put(2*num)
}
object MyBox extends Box with DoubleBox
MyBox.put(3)
It works fine and prints 6
But when I try:
object MyBox extends Box with DoubleBox with DoubleBox
It can't be compiled:
error: trait DoubleBox is inherited twice
I wonder why there is such limitation while my code looks reasonable?