Skip to content

Commit 55605ae

Browse files
committed
Merge pull request astaxie#137 from HoNooD/patch-1
Update 2.5.md
2 parents 4c3020a + 08d109e commit 55605ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

2.5.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ method的语法如下:
271271
sam.SayHi()
272272
}
273273

274-
### method重载
275-
上面的例子中,如果Emplyee想要实现自己的SayHi,怎么办?简单,和匿名字段冲突一样的道理,我们可以在Emplyee上面定义一个method,重载了匿名字段的方法。请看下面的例子
274+
### method重写
275+
上面的例子中,如果Emplyee想要实现自己的SayHi,怎么办?简单,和匿名字段冲突一样的道理,我们可以在Emplyee上面定义一个method,重写了匿名字段的方法。请看下面的例子
276276

277277
package main
278278
import "fmt"
@@ -298,7 +298,7 @@ method的语法如下:
298298
fmt.Printf("Hi, I am %s you can call me on %s\n", h.name, h.phone)
299299
}
300300

301-
//Employee的method重载Human的method
301+
//Employee的method重写Human的method
302302
func (e *Employee) SayHi() {
303303
fmt.Printf("Hi, I am %s, I work at %s. Call me on %s\n", e.name,
304304
e.company, e.phone) //Yes you can split into 2 lines here.

0 commit comments

Comments
 (0)