浏览代码

联系替换未练习,修正文字错误 (#264)

lyb124553153 9 年之前
父节点
当前提交
0ed0d46af8
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      eBook/10.6.md

+ 4 - 4
eBook/10.6.md

@@ -106,7 +106,7 @@ func main() {
 **练习 10.6** employee_salary.go
 
 定义结构体 `employee`,它有一个 `salary` 字段,给这个结构体定义一个方法 `giveRaise` 来按照指定的百分比增加薪水。
-  
+
 **练习 10.7** iteration_list.go
 
 下面这段代码有什么错?
@@ -122,14 +122,14 @@ func (p *list.List) Iter() {
 
 func main() {
 	lst := new(list.List)
-	for _= range list.Iter() {	
+	for _= range list.Iter() {
 	}
 }
 ```
 
 类型和作用在它上面定义的方法必须在同一个包里定义,这就是为什么不能在 int、float 或类似这些的类型上定义方法。试图在 int 类型上定义方法会得到一个编译错误:
 
-    cannot define new methods on non-local type int 
+    cannot define new methods on non-local type int
 
 比如想在 `time.Time` 上定义如下方法:
 
@@ -582,7 +582,7 @@ func main() {
 
 **练习 10.9** point_methods.go:
 
-从 `point.go` 开始(第 10.1 节的联系):使用方法来实现 `Abs()` 和 `Scale()`函数,`Point` 作为方法的接收者类型。也为 `Point3` 和 `Polar` 实现 `Abs()` 方法。完成了 `point.go` 中同样的事情,只是这次通过方法。
+从 `point.go` 开始(第 10.1 节的练习):使用方法来实现 `Abs()` 和 `Scale()`函数,`Point` 作为方法的接收者类型。也为 `Point3` 和 `Polar` 实现 `Abs()` 方法。完成了 `point.go` 中同样的事情,只是这次通过方法。
 
 **练习 10.10** inherit_methods.go: