elm*_*elm 9 generics alias types scala
让以下类型别名
class Container[T]
type MyInt = Container[Int]
是否有可能以及如何在类型别名中声明类型参数,尝试过
type MyInt2 = Container[T <: Int]    // error: ']' expected but '<:' found.
cch*_*tep 16
你可以做:
type MyInt2[T <: Int] = Container[T]
对于其他成员(例如def),类型成员必须在其声明/签名(左)中声明类型参数,而不是在正文(右)中声明.
| 归档时间: | 
 | 
| 查看次数: | 2818 次 | 
| 最近记录: |