I understood that Go has no inheritance and works with composition.
Here is my small example:
type Car struct {
XMLName xml.Name `xml:"response"`
// some properties coming from a XML file
}
type Audi struct {
Car
// some more properties coming from a XML file
}
func UnmarshalFromXML(url string, car *Car) { /* fill the properties from the XML file */ }
What I actually want:
var audi Audi
UnmarshalFromXML("someURL", &audi)
But this does not work, because there is no inheritance. But I need structs to use the unmarshal functionality for XML files.
So what to do?