我有兩個結(jié)構(gòu):type person struct { name string age int}type class struct { students []person }假設(shè)在主函數(shù)中,我創(chuàng)建并填充了兩個 person 變量,然后我想將它們添加到具有類類型的變量中。我該怎么做?IE s := person{name: "Sean", age: 50} t := person{name: "Nicola", age: 35} 我如何將 s 和 t 放入: lab:=class?
- 1 回答
- 0 關(guān)注
- 214 瀏覽
添加回答
舉報
0/150
提交
取消