我以為我了解Go的類和方法接收器,但顯然不了解。它們通常直觀地工作,但是在下面的示例中,使用它似乎會導致“未定義:Wtf”錯誤:package maintype Writeable struct { seq int}func (w Writeable) Wtf() { // causes a compile error//func Wtf() { // if you use this instead, it works}func Write() { Wtf() // this is the line that the compiler complains about}func main() {}我正在使用上個月左右從golang和LiteIDE下載的編譯器。請解釋!
- 2 回答
- 0 關注
- 246 瀏覽
添加回答
舉報
0/150
提交
取消