The Learning Journey Of Go

This is my sixth time to learn go,it has been a long time since the last learning.During this learning,i learned

(1) methods

go does not have classes,butbwe can define methods on types.You can only declare a method with a receiver whose type is defined in the samepackage as the method. You cannot declare a method with a receiver whose type ísdefined in another package (which includes the built-in types such as int).

1b8dd60f285a45038c84eede2c017195.png

Functions that take a value argument must take a value of that specific type:

0c86188a44dd42b4b947107f4b3d77bb.pngall methods on a given type should have either value or pointer receivers,but not a mixture of both.

(2)interface

If the concrete value inside the interface itself is nil, the method will be called with a nilreceiver.Note that an interface value that holds a nil concrete value is itself non-nil.

type assertion,has similarity in syntax with map.

stringer,A Stringer is a type that can describe itself as a string. and reader interface \image interface .

because i have long time not to read ,the speed of reading is slow.it cost me 90 minutes.i need to insist.

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值