4 ms·
This tries really hard to look like an official resource, but it seems to be run by some random IT consultancy. What they call inheritance is a narrow syntacti
by majewsky 6y ago
This tries really hard to look like an official resource, but it seems to be run by some random IT consultancy.
What they call inheritance is a narrow syntactic sugar intended to forward method calls to a member without having to write something like
func (x Outer) Frobnicate(val int) {
x.inner.Frobnicate(val)
}
by hand. It's arguably not inheritance because Liskov substitution is not permitted:
type Outer struct {
Inner
}
func process(i Inner) { ... }
var x Outer
process(x) // ERROR: type mismatch
process(x.Inner) // OK