package main
import "fmt"
type testIface interface{
PrintName()
}
type sonStruct struct{
name string
}
func (s sonStruct) PrintName() {
fmt.Println(s.name)
}
func (s sonStruct) SetName(newName string) {
s.name = newName
}
func (s sonStruct) PrintDefault() {
fmt.Println()
}
type fatherStruct struct{
son testIface
}
func main () {
//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
s := sonStruct{name: "Jack"}
f := fatherStruct{son: s}
f.son.PrintName()
f.son.(sonStruct).
fmt.Println(f.son.(sonStruct))
}