You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/essential/base/80.method.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ func (i IntSlice) Len() int {
21
21
}
22
22
```
23
23
24
-
先声明了一个类型`IntSlice`,其底层类型为`[]int`,再声明了三个方法`Get`,`Set`和`Len`,方法的长相与函数并无太大的区别,只是多了一小段`(i IntSlice)` 。`i`就是接收者,`IntSlice`就是接收者的类型,接收者就类似于其他语言中的`this`或`self`,只不过在 Go 中需要显示的指明。
24
+
先声明了一个类型`IntSlice`,其底层类型为`[]int`,再声明了三个方法`Get`,`Set`和`Len`,方法的长相与函数并无太大的区别,只是多了一小段`(i IntSlice)` 。`i`就是接收者,`IntSlice`就是接收者的类型,接收者就类似于其他语言中的`this`或`self`,只不过在 Go 中需要显式的指明。
0 commit comments