5 ms·
I come from C++ background, so by "direct support", I think he means a language construct that clearly shows the inheritance relationship, as in Java:
by shared4you 13y ago
I come from C++ background, so by "direct support", I think he means a language construct that clearly shows the inheritance relationship, as in
Java:
public class MountainBike extends Bicycle
or C++:
class MountainBike: public Bicycle
From those links, it looks like in Go, you use an anonymous struct inside a normal class. I would call it "aggregation" or "containment" (or implicit delegation), not inheritance. It suggests "has-a" relationship rather than an "is-a" relationship. The Go's "syntax" for inheritance (if you can call that) is ambiguous, unlike C++ or Java.
- Evbn 13y agoInheritance is implicit delegation, in any language. The "implicit" is what makes it inheritance.
- codygman 13y agoI don't see any downsides to this though, could you enumerate any you can think of? For instance, I believe I an model relationships either way and accomplish the same thing with little to no difference.