Почему я не могу присвоить * Struct * интерфейсу?
Я просто работаю черезПойти тур, и я'Я запутался в указателях и интерфейсах. Почему нетт этот код 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