Go语言中文网 为您找到相关结果 1

Go中interface嵌入和interface转换

// code_22_interface_field_interface project main.go package main import ( "fmt" ) type Humaner interface { SayHi() } type Personer interface { Humaner Sing(lyrics string) //lyrics 歌词 } type Student struct { name string score float64 } func (s *Student) SayHi() { fmt.Printf("Student[%s, %f]say hi!\n", s.name, s.score) } func (s *Student) Sing(lyric...阅读全文

博文 2018-10-06 02:35:09 ck_god