有:
class A
class B extends A
正确的写法是:
val foo: Seq[A] = List[B](new B)
出错时我会错过什么?
def bar[L <: A](): Seq[L] = List[B](new B)
错误:
[error] found : List[B]
[error] required: Seq[L]
[error] def t[L <: A](): Seq[L] = List[B](new B)
有:
class A
class B extends A
正确的写法是:
val foo: Seq[A] = List[B](new B)
出错时我会错过什么?
def bar[L <: A](): Seq[L] = List[B](new B)
错误:
[error] found : List[B]
[error] required: Seq[L]
[error] def t[L <: A](): Seq[L] = List[B](new B)