``` go type I interface{} type II interface{ f1() } func g2(a II) { fmt.Println("xxx") } func h3(b I) { g2(b.(II)) } type Message struct { Name string `json:"msg_name"` } func (*Message) f1() { } func main(){ var m = Message{ Name: "Alice", } h3(&m) } ``` `h3`函数中的`g2(b.(II))`这到底是个什么用法?接口强制转换?不像啊,我知道`b`其实是从`I接口`动态转过来的`*Message`类型,那这个`b.(II)`算啥意思?
有疑问加站长微信联系(非本文作者)
