go语言之结构体struct继承
// 错误的继承
type XMLData struct {
ID int
XMLNodes XMLNodes
}
// 正确的继承
type XMLData struct {
ID int
XMLNodes
}
// 被继承的struct
type XMLNodes struct {
Footer1 string `xml:"footer1"`
Footer2 string `xml:"footer2"`
Footer3 string `xml:"footer3"`
}
【勤则百弊皆除】