相关疑难解决方法(0)

特质继承与自我类型注释的区别

在Scala中,我已经看到了这些结构

trait T extends S
Run Code Online (Sandbox Code Playgroud)

trait T { this: S =>
Run Code Online (Sandbox Code Playgroud)

用于实现类似的东西(即S必须在创建实例之前定义抽象方法).他们之间有什么区别?你为什么要用另一个呢?

scala traits composition self-type

41
推荐指数
4
解决办法
7753
查看次数

标签 统计

composition ×1

scala ×1

self-type ×1

traits ×1