链式调用风格
//核心就在 this.type
class Animal {
def breathe: this.type = this }
class Cat extends Animal {
def eat : this.type = this }
object Singleton_Types {
def main(args: Array[String]): Unit =
链式调用风格
//核心就在 this.type
class Animal {
def breathe: this.type = this }
class Cat extends Animal {
def eat : this.type = this }
object Singleton_Types {
def main(args: Array[String]): Unit =