package main import "fmt" type Student struct { Name string } // 函数 func mthod(s Student) { fmt.Println(s.Name) } func mthod1(s *Student) { fmt.Println((*s).Name) } func (s *Student) test02() { fmt.Println(s.Name) } func main() { var stu = Student{"笑傲"} mthod(stu) mthod1(&stu) (&stu).test02() var s = Student{ Name: "xio", } fmt.Println(s) var s3 *student = &student{ age: 19, } fmt.Println(s3) }