I have created two instances of same struct, Confused by the output when I compare two variables point to instances of struct.
package main
import "fmt"
type Person struct {
name string
}
func main() {
p1 := &Person{name: "guru"}
p2 := &Person{name: "guru"}
fmt.Println(p1 == p2) // false, compares by address?
p3 := Person{name: "guru"}
p4 := Person{name: "guru"}
fmt.Println(p3 == p4) // true , why? compares by content?
}
does == operator works like overload operator?