interface
函数抽象
type MyInterface interface {
Load() (int, error)
}实现接口
type MyStruct struct { }
func (myStruct *MyStruct) Load() (int, error) {
return 0, nil
}声明语义
var v1 MyInterface
if v1 == nil {
fmt.PrintLn("v1 is nil")
}接口赋值
空接口
Last updated