package main import "fmt" type Circle struct { radius float64 } func main() { var c Circle c.radius = 10 fmt.Println("圆的面积 = ", c.getArea()) } func (c Circle) getArea() float64 { return 3.14 * c.radius * c.radius }