ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` package main import "fmt" type Person struct {     Name string     age  int } type son struct {     mother string     father string } type student struct {     Person     son     Name string     id string } func (p *Person) String() {     fmt.Printf("Name:%s\tAge:%d\n", p.Name, p.age) } func (p *student) String() {     fmt.Printf("student Name:%s\t home Name:%s\t Age:%d\n", p.Name, p.Person.Name, p.age) } func main() {     p := &student{}     p.Name = "tom"     p.Person.Name = "tom1"     p.Person.String()     p.String() } ``` Name:tom1 Age:0 student Name:tom home Name:tom1 Age:0