typePeople struct{} func(p *People) ShowA() { fmt.Println("showA") p.ShowB() } func(p *People) ShowB() { fmt.Println("showB") } typeTeacher struct{ P People } func(t *Teacher) ShowB() { fmt.Println("teacher showB") } funcmain() { t := Teacher{} t.ShowA() //报错 t.People.ShowA() //报错 t.People.ShowB() //报错 t.ShowA() // 报错 t.ShowB() //teacher showB t.P.ShowA() //showA\nshowB t.P.ShowB() //showB }