Defining a function with multiple implicit arguments in Scala

后端 未结 3 1443
[愿得一人]
[愿得一人] 2021-01-30 12:36

How can I define a function with multiple implicit arguments.

def myfun(arg:String)(implicit p1: String)(implicit p2:Int)={} // doesn\'t work
3条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 12:40

    They must all go in one parameter list, and this list must be the last one.

    def myfun(arg:String)(implicit p1: String, p2:Int)={} 
    

提交回复
热议问题