Answer the question
In order to leave comments, you need to log in
Why are "reference" methods needed and why don't they satisfy interfaces?
I often see that function parameters, structure properties in Go are passed as links. In general, this is understandable - I read that it saves memory + you can check for nil to check for an untransmitted parameter. However, it is a little confusing when methods are tied to a structure through "*":
type Speaker interface {
Speak()
}
type Human struct {}
func (h *Human) Speak() {
}
Answer the question
In order to leave comments, you need to log in
func (h *Human) Speak() {
}
func Speak(h *Human) {
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question