Answer the question
In order to leave comments, you need to log in
How to create an object by the name of the structure?
There are several structures and there is a function that takes the name of the structure as input, how to create an object by the name of the structure
type CurrentStatus struct {
CURENTSTID int
NAME string
}
type EstateStatus struct {
ESTSTATID int
NAME string
SHORTNAME
}
func Create(path string) {
var i :=new(path)
}
Answer the question
In order to leave comments, you need to log in
Get a map with a string key, and as a value, a function that creates an instance of the desired type.
Or good old switch/case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question