package main
import "fmt"
type Father struct {
MingZi string
}
func (this *Father) Say() string {
return "大家好,我叫 " + this.MingZi
}
type Mother struct {
Name string
}
func (this *Mother) Say() string {
return "Hello, my name is " + this.Name
}
type Child struct {
Father
Mother
}
func main () {
//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
c := new(Child)
c.MingZi = "张小明"
c.Name = "Tom Zhang"
// c.Say() //ambiguous selector c.Say
fmt.Println(c.Father.Say())
fmt.Println(c.Mother.Say())
fmt.Println("Hello JSRUN! \n\n - from Golang .")
}