simple REPL test…
def g(a:Int)(implicit b:Int) = {a+b}
Why do neither of these attempted usages work?
1.
scala> class A { var b:Int =8; var c = g(2) }
:6: error: could not find implicit value for parameter b: Int
class A { var b:Int =8; var c = g(2) }
2.
scala> class A(var b:Int) { var c = g(2) }
:6: error: could not find implicit value for parameter b: Int
class A(var b:Int) { var c = g(2) }
^
Thanks
you need to define b as implicit in A
In general, only values/methods that are defined as implicits will be considered and they are searched in scope, or in the companion object of the required type (Int in this case)