~~~
package main
import "fmt"
//人
type Person struct {
name string
sex byte
age int
}
//学生
type Student struct {
Person
id int
addr string
}
func main() {
var s Student
s.id = 1
s.addr = "HZ"
s.Person.name = "Bob"
s.Person.sex = 'm'
s.Person.age = 18
fmt.Println(s) //{{Bob 109 18} 1 HZ}
}
~~~