Debug客栈

Recent content on Debug客栈

马上订阅 Debug客栈 RSS 更新: https://blog.debuginn.com/index.xml

[译] 方法是否应该在 T 或 *T 上声明

2021年6月27日 23:18
Featured image of post [译] 方法是否应该在 T 或 *T 上声明

译文原地址:Should methods be declared on T or *T - David

在 Go 中,对于任何的类型 T,都存在一个类型 *T,他是一个表达式的结果,该表达式接收的是类型 T ,例如:

1
2
3
type T struct { a int...

剩余内容已隐藏

查看完整文章以阅读更多