When I do want to define my own custom getter, how might I tell the
language that my new method is a custom getter and not just a method with
no arguments and one return value? I think if Go were to have properties,
they would have to be explicitly marked as a property in some way to avoid
this.
F
The other day I had an interesting idea: What if all exported fields have
an implicit getter. Like e.g.
type Human struct {
Age uint
Name string
}
would implicitly get the methods:
func (h Human) Name() string {
return h.Name
}
func (h Human) Age() uint {
return h.Age
}
*When defining an int