week03 作业
type example struct {
name string
}
var instance *example
func init() {
instance = new(example)
instance.name = "test"
}
func GetInstance() *example{
return instance
}
func main() {
exam := GetInstance()
}
type example struct {
name string
}
var instance *example
func init() {
instance = new(example)
instance.name = "test"
}
func GetInstance() *example{
return instance
}
func main() {
exam := GetInstance()
}
评论