【发布时间】:2018-07-16 13:38:48
【问题描述】:
我有一个 Go 界面:
type People interface {
GetName() string
GetAge() string
}
现在我想要另一个接口Student:
1.
type Student interface {
GetName() string
GetAge() string
GetScore() int
GetSchoolName() string
}
但我不想写重复的函数GetName和GetAge。
有没有办法避免在Student 接口中写入GetName 和GetAge?喜欢:
2.
type Student interface {
People interface
GetScore() int
GetSchoolName() string
}
【问题讨论】: