import"fmt" type Animal interface{ eat() } type Live interface{ work() } type Dog struct{ name string } type People struct{ age int } func(dogDog)eat() { fmt.Println(dog.name) } func(pPeople)work() { fmt.Println(p.age) } type Family struct{ Dog People } func main() { f :...
package main import ( "fmt" ) type Animal struct { Age int } type Person struct { Animal Sex int } func (animal *Animal) getAge() int { return animal.Age } func (animal *Animal) getName() string { return "animal" } func (person Person) getSexName() string { return "man" } ...