其他分享
首页 > 其他分享> > go语言第九课时

go语言第九课时

作者:互联网

 

 1.接口多态

package main
import "fmt"
type Humon interface {
    syHi()
}
type Person struct {

}
type Student struct{

}
func (p *Person) sayHi(){
    fmt.Println("this is persion");
}
func ( stu *Student) sayHi(){
    fmt.Printf("this is student");
}
func main(){
    humn:=Person{};
    humn.sayHi();
}

 

标签:func,语言,fmt,Person,第九课,go,type,sayHi,struct
来源: https://www.cnblogs.com/zh718594493/p/14285693.html