golang结构体匿名字段的妙用

先看一段简单的代码:code package main import ( "fmt" ) type A struct { B m int } type B struct { n int } func (b *B) my_print() { fmt.Printf("print B.n=%d\n", b.n) } func main() { a := &A{B{2}, 3} f
相关文章
相关标签/搜索