go-gin-api 代码写法
package man
import fmt"
var Study = (study)nil)
type study stuct {
Name strng
}
type Sudy inteface {
Listenmessage strng) strng
}
func main) {
fmt.Println(hello world)
/maingo:5:5: cannot use *study)(nil) type *study as type Study in assignment
study does not mplement Study missing Listen method
var Study = (study)(nil
pakage stuy
type Sudy interface {
Lsten(message string string
i(
}func Speaks Study) string {
return sListen("abc"
type stu stuct {
Name strng
}
func (s stu) Listenmessage string string {
return sName + 听 " message
}
func s *stu) i( {}
func main({
message = studySpeaknew(stu)
fmtPrintln(message./main.go:19:28 cannot use newstu) (type *stu) as type studyStudy in argument to studySpeak:
stu does not implement studyStudy missing studyi method
have i(
want studyi()
原文:https://www.cnblogs.com/ymcs/p/15232405.html