Files
moxa/_test/method15.go
2018-11-08 11:31:23 +01:00

16 lines
175 B
Go

package main
type Coord struct {
x, y int
}
func (c Coord) dist() int { return c.x*c.x + c.y*c.y }
func main() {
o := &Coord{3, 4}
println(o.dist())
}
// Output:
// 25