We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab97ce2 commit 1eff6adCopy full SHA for 1eff6ad
_zh-cn/tour/self-types.md
@@ -15,7 +15,7 @@ previous-page: compound-types
15
---
16
自类型用于声明一个特质必须混入其他特质,尽管该特质没有直接扩展其他特质。 这使得所依赖的成员可以在没有导入的情况下使用。
17
18
-自类型是一种缩小 `this` 类型或 `this` 别名类型的方法。 语法看起来像普通函数语法,但是意义完全不一样。
+自类型是一种细化 `this` 或 `this` 别名之类型的方法。 语法看起来像普通函数语法,但是意义完全不一样。
19
20
要在特质中使用自类型,写一个标识符,跟上要混入的另一个特质,以及 `=>`(例如 `someIdentifier: SomeOtherTrait =>`)。
21
```tut
@@ -24,7 +24,7 @@ trait User {
24
}
25
26
trait Tweeter {
27
- this: User => // 重新分配 this 的类型
+ this: User => // 重新赋予 this 的类型
28
def tweet(tweetText: String) = println(s"$username: $tweetText")
29
30
0 commit comments