struct
type Account struct {
id int
name int
}必須大寫
type Account struct {
Id int
Name int
}初始化
point := struct{ x, y int }{10, 20}
或是
point := new(Account)更改值
傳值
傳地址
Struct inside Struct
把func 加入到 struct內
第一種:
第二種:
Value receiver, Pointer receiver
Func 傳值與傳址
iterate struct 內的值
引入其他 package 的 struct
Last updated