type Person struct {
// 属性
name string
age int
sex bool
hobby []string
}
可以在定义struct的时候就设置默认的属性值吗?
golang struct定义的时候属性能否设置默认值?
type Person struct {
// 属性
name string
age int
sex bool
hobby []string
}
可以在定义struct的时候就设置默认的属性值吗?