def ma(x: Int)(y:Int) = x * yma(2)(6)println(ma(2)(6))
scala> def mb(x: Int) = (y: Int) => x * ymb: (x: Int)Int => Intscala> mb(2)res1: Int => Int = $$Lambda$1075/1699826397@79e7188escala> mb(2)(7)res2: Int = 14
定义个默认值
def ma(x: Int)(implicit y:Int = 100) = x * yprintln(ma(2))
隐式值导入
他会寻找同类型的,找到类型一样的就用这个值
但是不能在多个类中找到
object Context {implicit val aaa: Int = 1024}object CaseDemo extends App {def ma(x: Int)(implicit y:Int = 100) = x * yimport Context._println(ma(2))}
