为了账号安全,请及时绑定邮箱和手机立即绑定

这里有一个问题,是关于go语言的一个疑问?

这里有一个问题,是关于go语言的一个疑问?

ITMISS 2021-06-13 14:10:06
package mainimport ("fmt")type people struct{name stringage uintsex bool}type Ipeople interface{get() peopleshow_name()show_age()show_sex()}func(this people)show_name(){fmt.Println(this.name)}func(this people)show_age(){fmt.Println(this.age)}func(this people)show_sex(){fmt.Println(this.sex)}func(this people)get() people{return this}func main(){var interf Ipeople = people{"asdf",18,true}interf.show_name()fmt.Println(interf.(people))}这最后一句中的interf.(people)是什么意思??接口调用匿名函数?大佬求教!
查看完整描述

1 回答

?
炎炎设计

TA贡献1808条经验 获得超4个赞

表示接口interf指向的实例对象是不是people类型

查看完整回答
反对 回复 2021-06-15
  • 1 回答
  • 0 关注
  • 335 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号