Mar 16, 2021
This belongs in the "The Good" section ;)
Go has composition, which is much better than inheritance. Your example can be much simpler by the way:
type Node struct {
tag int
}
func (n Node) getTag() int {
return n.tag
}
type FunctionDefinition struct {
Node
}
Now you can call getTag() on an instance of FunctionDefinition.
Edit: Well, I'm trying to get this in a code block in order to get it more readable, but I can't get it to work.