I have the following struct and :
type Person struct {
Name string
}
steve := Person{Name: "Steve"}
Can you explain how the following 2 methods (one without the pointer and one with in the receiver) both are able to print the p.Name?
func (p *Person) Yell() {
fmt.Println("Hi, my name is", p.Name)
}
func (p Person) Yell(){
fmt.Println("YELLING MY NAME IS", p.Name)
}
steve.Yell()
Wouldn't the Name not exist when pointing straight to the Person (not the instance steve?)