Go get ellipsis (#1)
* gi: rename gi_c into _gi_c * gi: rename test into _test * gi: fix README syntax
This commit is contained in:
committed by
Marc Vertes
parent
f9706f970f
commit
476a31322d
20
_test/method3.go
Normal file
20
_test/method3.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
type Coord struct {
|
||||
x, y int
|
||||
}
|
||||
|
||||
func (c Coord) dist() int { return c.x*c.x + c.y*c.y }
|
||||
|
||||
type Point struct {
|
||||
Coord
|
||||
z int
|
||||
}
|
||||
|
||||
func main() {
|
||||
o := Point{Coord{3, 4}, 5}
|
||||
println(o.Coord.dist())
|
||||
}
|
||||
|
||||
// Output:
|
||||
// 25
|
||||
Reference in New Issue
Block a user