Solution Review: Coordinates of a Point
This lesson discusses the solution to the challenge given in the previous lesson.
We'll cover the following...
We'll cover the following...
In the above code, look at line 7. We make a struct of type Point that is a 2D point. It has two fields X and Y, both of type float64.
Now, we need to write a method Abs(). See its header at line 11: func (p *Point)Abs() float64 . From its header, it’s clear that this method can be called only by a pointer to the object of type Point. In the next line, the ...