首页 > 其他 > 详细

invalid receiver type

时间:2016-08-07 10:53:38      阅读:261      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!