import "fmt"
type Point struct {
x int32
y int32
}
type Circle struct {
radius float64
center *Point
}
func main() {
c1 := Circle{1.5, &Point{2, 3}}
fmt.Println(c1)
fmt.Println(c1.center)
fmt.Println(c1.center.x, c1.center.y)
}
//cmd
C:\Users\bob\golang1>go run tutorial.go
{1.5 0xc0000120a0}
&{2 3}
2 3
reference:
No comments:
Post a Comment