码迷,mamicode.com
首页 > 其他好文 > 详细

invalid receiver type

时间:2016-08-07 10:54:01      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:

Because in a case like this:

type I int
type P *I
func (i I) Get() int { return int(i) }
func (p P) Get() int { return int(*p) }
var v I
var x = (&v).Get()

it would be unclear whether the Get method in the last line would be
I.Get or P.Get.  We could define a rule for it, but that would become
another thing that people would have to know.

 

https://groups.google.com/forum/#!topic/golang-nuts/qf76N-uDcHA

invalid receiver type

标签:

原文地址:http://www.cnblogs.com/jvava/p/5745661.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!