mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-11-24 15:18:57 +00:00
fix wrong translation
This commit is contained in:
parent
07073a0b25
commit
8d5121dd01
@ -72,13 +72,13 @@ Point{1, 2}.Distance(q) // Point
|
|||||||
pptr.ScaleBy(2) // *Point
|
pptr.ScaleBy(2) // *Point
|
||||||
```
|
```
|
||||||
|
|
||||||
或者接收器形参是类型T,但接收器实参是类型`*T`,这种情况下编译器会隐式地为我们取变量的地址:
|
或者接收器实参是类型T,但接收器形参是类型`*T`,这种情况下编译器会隐式地为我们取变量的地址:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
p.ScaleBy(2) // implicit (&p)
|
p.ScaleBy(2) // implicit (&p)
|
||||||
```
|
```
|
||||||
|
|
||||||
或者接收器形参是类型`*T`,实参是类型T。编译器会隐式地为我们解引用,取到指针指向的实际变量:
|
或者接收器实参是类型`*T`,形参是类型T。编译器会隐式地为我们解引用,取到指针指向的实际变量:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
pptr.Distance(q) // implicit (*pptr)
|
pptr.Distance(q) // implicit (*pptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user