@Test def testOK() = { case class Student[T, S <% Comparable[S]](var name: T, var height: S) val s = Student("john", "170") //下面这条语句在视图界定中是合法的 //因为Int类型此时会隐工转换为 //RichInt类,而RichInt类属于Comparable、 //继承层次结构 val s2 = Student(190, 170) }
@Test def testOK() = { case class Student[T, S <% Comparable[S]](var name: T, var height: S) val s = Student("john", "170") //下面这条语句在视图界定中是合法的 //因为Int类型此时会隐工转换为 //RichInt类,而RichInt类属于Comparable、 //继承层次结构 val s2 = Student(190, 170) }