如果我有 golang
type Animal string
const (
Cat Animal = "cat"
Dog Animal = "dog"
Mouse Animal = "mouse"
)
我应该如何编写原型?如果我使用枚举,那么我需要手动映射自己吗?
enum Animal {
CAT = 0;
DOG = 1;
MOUSE = 2;
}
繁星coding
相关分类