trait A{
def m1(x:Int)(implicit b:Builder) = ???
def m2(x:Char)(implicit b:Builder) = ???
def m3(x:String)(implicit b:Builder) = ???
def m4()(implicit b:Builder) = ???
}
I have a trait A like code above. All method in A need a implicit builder
. I felt that implicit b:Builder
is too redundent. I was thinking to use a attribute of builder like code below, however Builder is not supposed to be a memeber in class B
:
class B extends A{
implicit val b:Builder = ???
}
what's the suitable design pattern for this?
Aucun commentaire:
Enregistrer un commentaire