mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 03:06:41 +08:00
fix 10.6.3
修改语法错误
This commit is contained in:
@@ -238,9 +238,9 @@ func main() {
|
||||
我们知道方法将指针作为接收者不是必须的,如下面的例子,我们只是需要 `Point3` 的值来做计算:
|
||||
|
||||
```go
|
||||
type Point3 struct { x, y, z float }
|
||||
type Point3 struct { x, y, z float64 }
|
||||
// A method on Point3
|
||||
func (p Point3) Abs float {
|
||||
func (p Point3) Abs() float64 {
|
||||
return math.Sqrt(p.x*p.x + p.y*p.y + p.z*p.z)
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user