如何实现这样的功能? ?<What_to_use_here>
func callfunc(type string) <What_to_use_here> {
if type == "string"{
return "I am a string"
} else if type == "integer"{
return 1
}
return nil
}
type Sample struct {
value_int int
value_str string
}
type Sample s
s.value_int = callFunc("integer")
s.value_str = callFunc("string")
我需要将来自调用Func的值分配给指定的类型,如下所示。所以我认为返回界面将不起作用。需要帮助。
至尊宝的传说
摇曳的蔷薇
相关分类