接口 抽象 集合
多态 用接口实现变量
面向对象
//声明接口 interface
type Behavior interface{
Run() string
Eat() string
}
//动物
type Animal struct {
Colour string
}
// 狗
type Dog struct {
Animal
ID int
Name string
Age int
}
func main() {
var dog demo.Dog
dog.ID = 3
dog.Name = "struct"
dog.Colour = “red”
dog.Run()
}