Go语言int类型绑定方法

 
package main

import (
	"fmt"
)

type TZ int

func main() {
	var t TZ
	fmt.Println(t)
	t.increase(100)
	fmt.Println(t)
}

func (t *TZ) increase(add int) {
	*t += TZ(add)
}
 

转载于:https://my.oschina.net/itfanr/blog/195615

猜你喜欢

转载自blog.csdn.net/weixin_34007291/article/details/91799335