Supoose that I have a Vertex
type
type Vertex struct {
X, Y float64
}
and I've defined a method
func (v *Vertex) Abs() float64 {
return math.Sqrt(v.X*v.X + v.Y*v.Y)
}
What's the difference between those two calls ? (both of them return the same result)
v1 := Vertex{3, 4}
fmt.Println(v1.Abs())
v2 := &Vertex{3, 4}
fmt.Println(v2.Abs())