最近,我看了一个 隐式链 的例子,implicit def foo[C3 <% C](c: C)
。我认为我对于<%和(implicit c : C)之间的区别感到困惑。
如果我写成 implicit def bToC[C3 <: C](c: C)(implicit c3 : C3),它会给出编译错误,但是这是为什么呢?implicit def 应该在作用域内啊?
编辑:
有人能解释一下为什么
implicit def aToB[A1 : A](a: A1)(implicit ev: Int => A1): B = new B(a.n, a.n)
和
implicit def aToB[A1 <: A](a: A1)(implicit ev: Int => A1): B = new B(a.n, a.n)
不起作用吗?
非常感谢!