如何将 reflect.Value 转换为它的类型?
type Cat struct {
Age int
}
cat := reflect.ValueOf(obj)
fmt.Println(cat.Type()) // Cat
fmt.Println(Cat(cat).Age) // doesn't compile
fmt.Println((cat.(Cat)).Age) // same
梵蒂冈之花
皈依舞
慕桂英3389331
随时随地看视频慕课网APP
相关分类