class A{ def f()=println("A") } class B extends A{ override def f()=println("B") } class C[+T](val a:T){} class D[-T](val a:T){} object main { def main(args: Array[String]) { val v1:C[A] = new C[A](new B()) v1.a.f() val v2:D[B] = new D[A](new A()) v2.a.f() //这一步会报错,不知道为什 } }