http://play.golang.org/p/v1rp9-GN69我收到錯(cuò)誤 panic: interface conversion: interface is *main.Node, not *main.Player從這一行l(wèi) := new_linked_list.GetLength()for i:=0; i < l; i++ { fmt.Printf("Removing %v\n", new_linked_list.Pop().(*Player).name)}但對(duì)我來說它看起來是正確的,如果我將 (*Player) 更改為 (*Node),我會(huì)收到另一個(gè)錯(cuò)誤。我應(yīng)該如何修復(fù)此代碼以及接口轉(zhuǎn)換恐慌是什么意思?http://play.golang.org/p/v1rp9-GN69提前致謝。
- 1 回答
- 0 關(guān)注
- 212 瀏覽
添加回答
舉報(bào)
0/150
提交
取消