Why is this Scala example of implicit paremeter not working?
- by Alex R
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