我正在嘗試 golang 嵌入,但以下代碼無法編譯:type Parent struct {}func (p *Parent) Foo() {}type Child struct { p *Parent}func main() { var c Child c.Foo()}和./tmp2.go:18:3: c.Foo undefined (type Child has no field or method Foo)我做錯了什么?
- 2 回答
- 0 關注
- 135 瀏覽
添加回答
舉報
0/150
提交
取消