1.接口的继承 示例: package main import "fmt" type Humaner interface { //子集 sayhi() } type Personer interface { //超集 Humaner //匿名字段,继承了sayhi() sing(lrc string) } type Student struct { name string id int } //Student实现了sayhi() func (tmp *Student) sayhi()…
1.go语音之进阶篇 示例: package main import "fmt" type Humaner interface { //子集 sayhi() } type Personer interface { //超集 Humaner //匿名字段,继承了sayhi() sing(lrc string) } type Student struct { name string id int } //Student实现了sayhi() func (tmp *Student) sayhi…
1.方法的继承 示例: package main import "fmt" type Person struct { name string //名字 sex byte //性别, 字符类型 age int //年龄 } //Person类型,实现了一个方法 func (tmp *Person) PrintInfo() { fmt.Printf("name=%s, sex=%c, age=%d\n", tmp.name, tmp.sex, tmp.age) } //…