-
Notifications
You must be signed in to change notification settings - Fork 1k
zh-cn for Scala Tour: inner-classes.md #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7e889b1
to
29573af
Compare
_zh-cn/tour/inner-classes.md
Outdated
@@ -13,3 +13,70 @@ language: zh-cn | |||
next-page: abstract-types | |||
previous-page: lower-type-bounds | |||
--- | |||
|
|||
在Scala中,一个类可以作为另一个类的成员。 在一些类似 Java 的语言中,内部类是外部类的成员,而 Scala 正好相反,内部类是绑定到外部对象的。 假设我们希望编译器在编译时阻止我们搞乱节点 nodes 与图形 graph 的关系。 路径依赖的类型提供了一种解决方案。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
搞乱
-> 混淆
?
。
-> ,
路径依赖的类型
-> 路径依赖类型
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
_zh-cn/tour/inner-classes.md
Outdated
|
||
在Scala中,一个类可以作为另一个类的成员。 在一些类似 Java 的语言中,内部类是外部类的成员,而 Scala 正好相反,内部类是绑定到外部对象的。 假设我们希望编译器在编译时阻止我们搞乱节点 nodes 与图形 graph 的关系。 路径依赖的类型提供了一种解决方案。 | ||
|
||
为了说明差异,我们简单描述了图形 graph 数据类型的实现: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一个图形数据类型
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
_zh-cn/tour/inner-classes.md
Outdated
} | ||
} | ||
``` | ||
该程序将图形表示为节点列表 (`List[Node]`)。 每个节点都有一个用来存储与其相连的其他节点的列表 (`connectedNodes`)。 类 `class Node` 是一个 _路径依赖的类型_,因为它嵌套在类 `class Graph` 中。 因此,`connectedNodes` 中存储的所有节点必须使用同一个 `Graph` 的实例对象的 `newNode` 方法来创建。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类 class Node
--> 类Node
?
路径依赖的类型
-> 路径依赖类型
类 class Graph
-> 类 Graph
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
类 class Graph
是根据英文原文来的,的确不妥。
108e28b
to
c97dfe5
Compare
Thanks a lot, @realwunan 🎉 |
Simplified Chinese version of Scala Tour: Inner Classes