Hi Haddock,
But what is happening in this example is *method shadowing* (or method hiding),
***This does not rule out inheritance.***
Please read this article on C#, describing exactly the same situation:
In the case of C#, the default behavior is the same as golang.
So, when the article "Gogle Go, A primer" says:
> ... From that we can conclude that delegation is taking place and not inheritance.
It is not correct. What you conclude from the example is that: "golang embedding implies *inheritance with method shadowing*"
Since golang behaves exactly as C# in this case (and we agree that in C# has "inheritance")
we conclude that in golang the situation can also be named "inheritance with method shadowing".
Thanks again. This has helped me a lot.
This conversation do not change what golang does, but I believe can be helpful to explain (to a C# programmer for example)
My next question, derived from all the kind answers from golang-nuts is:
"is embedding also composition"?
This new question seems a little less controversial. I'll try to write some examples and counter-examples
and I will open a new topic soon.
If the answer is "yes" is means that golang-embedding is a clever "new" concept which
includes good parts from "inheritance" and "composition", *without the problems!!".
That's a great win for golang, and that's why I want to explain golang-embedding in terms of classical OOP.
Thanks again to all in golang-nuts.