在 golang 中使用 reflect 調用結構中的方法

代碼以下: package main import ( "reflect" "fmt" ) type User struct { Id int Name string Age int } func (u User) Hello(name string) { fmt.Println("Hello",name,", I am",u.Name,".") }
相關文章
相關標籤/搜索