Use of abstract type in a concrete class? [duplicate]
问题 This question already has answers here : Concrete classes with abstract type members (2 answers) Closed 7 years ago . scala> class A { type T <: String; def f(a: T) = println("foo")} defined class A scala> (new A).f("bar") <console>:9: error: type mismatch; found : java.lang.String("bar") required: _1.T where val _1: A (new A).f("bar") ^ Class A has an abstract type T , but is not an abstract class. Creating an object of A (as shown) does not define type T . My first thought was, I am allowed