草庐IT

secretAgent

全部标签

go - 嵌入式结构还是嵌套结构?

下面的代码是EmbeddedStruct或NestedStruct还是其他的例子?并且我们是否在另一种类型结构(secretAgent)中使用一种结构类型(人)?packagemainimport"fmt"typepersonstruct{firststringlaststringageint}typesecretAgentstruct{personltkbool}funcmain(){sa1:=secretAgent{person:person{first:"James",last:"Bond",age:32,},ltk:true,}fmt.Println(sa1.first,sa1

go - 嵌入式结构还是嵌套结构?

下面的代码是EmbeddedStruct或NestedStruct还是其他的例子?并且我们是否在另一种类型结构(secretAgent)中使用一种结构类型(人)?packagemainimport"fmt"typepersonstruct{firststringlaststringageint}typesecretAgentstruct{personltkbool}funcmain(){sa1:=secretAgent{person:person{first:"James",last:"Bond",age:32,},ltk:true,}fmt.Println(sa1.first,sa1