You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package main
|
|
|
|
import "fmt"
|
|
|
|
type user struct {
|
|
id int
|
|
name string
|
|
age int
|
|
}
|
|
|
|
// 结构体方法
|
|
|
|
func(u user) Per() {
|
|
fmt.Println(u.name)
|
|
}
|
|
|
|
func main() {
|
|
users := user{id: 1, name: "song", age: 18}
|
|
users.Per()
|
|
} |