我对 Go 还是很陌生。是否可以从嵌入式父函数返回子类型?类似于以下代码的内容:type Humans struct { NextPage string}type Employees struct { Humans Items []struct { Stuff string DifferentStuff float64 } }func (h *Human) Next() interface{} { list interface{} jsonGet(h.NextPage, &list) return list}func main() { list := Employees{} jsonGet("http://blah.blah", &list) for ; list != nil; list = list.Next() { for _, item := range list.Items { ... do stuff ... } }}
- 1 回答
- 0 关注
- 142 浏览
添加回答
举报
0/150
提交
取消