4
* Structを* Interfaceに割り当てることができないのはなぜですか?
私はGoツアーを進めているだけですが、ポインタとインターフェースについて混乱しています。このGoコードがコンパイルされないのはなぜですか? package main type Interface interface {} type Struct struct {} func main() { var ps *Struct var pi *Interface pi = ps _, _ = pi, ps } つまり、Structがである場合Interface、なぜがにならない*Structの*Interfaceですか? 私が得るエラーメッセージは: prog.go:10: cannot use ps (type *Struct) as type *Interface in assignment: *Interface is pointer to interface, not interface
142
go