我想要这样的东西:
type MyInterface interface {
MyMetod(interface{})
}
并拥有类型
type MyType struct {}
用方法
func (mt *MyType) MyMethod(SomeConcreteType) {
// body
}
实现MyInterface。
但似乎 Go 无法处理这个问题。我收到一个错误,说它有MyMethod(SomeConcreteType)但它想要MyMethod(interface{})。为什么会这样,什么是解决这个问题的好方法?
慕盖茨4494581
相关分类