Ai
1 Star 0 Fork 0

liming/go-study

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 255 Bytes
一键复制 编辑 原始数据 按行查看 历史
liming 提交于 2023-11-03 09:16 +08:00 . 2023.11.3
package main
import "fmt"
type cat struct {
name string
age int
}
func (n *cat) add() {
n.age = n.age + 1
}
func (n cat) show() {
fmt.Println(n)
}
func main() {
newCat := cat{name: "kitty", age: 3}
newCat.show()
newCat.add()
newCat.show()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/liming0523/go-study.git
git@gitee.com:liming0523/go-study.git
liming0523
go-study
go-study
master

搜索帮助