实例是否实现了某个接口interface
func main(){
facestruct := new(FaceStruct)
facestruct.face = "testface"
var face interface{} = facestruct
if a, ok := face.(Face2); ok {
fmt.Printf("animal0 implement Animal interface!\n")
fmt.Println(a)
} else {
fmt.Printf("animal0 not implem.
原创
2022-01-25 09:39:49 ·
241 阅读 ·
0 评论