链式风格:
链式风格:在方法中返回当前对象! //对象.方法1().方法2().方法3().方法4().方法5()
this.type
this
class Stu{
def say(): this.type = {
println("say......")
this
}
def run(): Stu = {
println("run......")
this
}
def sleep(): Unit = {
println("sleep......")
}
}