//性别枚举
type Gander int
func (g Gander)String() string{
return []string{"Male","Female","Bisexual"}[g]
}
const (
//男的
Male = iota
//女的
Female
//二椅子
Bisexual
)
type Human struct {
Name string
Age int
Height int
Weight int
Looking int
Rmb int
//自己的性别
Sex Gander
//结婚对象的性别
TargetSex Gander
}
func main() {
}
go语言的性别枚举封装
猜你喜欢
转载自blog.csdn.net/dabao87/article/details/89145588
今日推荐
周排行