我想设置一个变量的上限。斯卡拉的上限
trait Container {
type A <: Number
def value: A
}
然后,当我试图得到一个值,我
object AnyNumber extends Container {
def value = 2
}
我得到这个错误
<console>:25: error: overriding type A in trait Container with bounds <: Number;
type A has incompatible type
type A = Int
^