在 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,".") }
相关文章
相关标签/搜索