I have a class A
which also defines an implicit conversion to B
.
case class A(number:Int)
case class B(number:Int, tag:String)
implicit def AtoB(a:A) = B(a.number,"Hello World")
I also have a function that retrieves A
and would like to invoke a function that takes as argument implicit B
:
def hello()(implicit b:B)= {....}
def execute = {
implicit val a:A = ....
hello() //doesnt compile missing implicit parameter b
}
How can I get this code to work without explicitly defining B
? i.e
val b:B = a