美文网首页
Golang没有class

Golang没有class

作者: 邪恶的奥伯伦 | 来源:发表于2019-10-28 16:50 被阅读0次

但是有一种概念叫method,需要接受用关键字type来定义的receiver,
method是一种特殊的函数 只不过接受的参数为一个用 type定义的receiver

传给methodreceiver有两种, 分为value receiverpointer receiver 区别在于 value receiver是一份copy 而pointer receiver 其值可以在method内部被永久修改。

相关文章

网友评论

      本文标题:Golang没有class

      本文链接:https://www.haomeiwen.com/subject/xlvbvctx.html