Hi Stefan,

your solution falls short on addressing the underlying problem of how to 
implement inheritance using dynamic dispatch through using interface. In 
the article "Inner Pattern to mimic Method Overwriting in Go 
there is a section with the headline "Motivation" where it says:

This means that "f.MoreMagic()" in the last line in the code snippet below 
(sample shamelessly stolen from [2 
does not print "foo magic" to the console as expected but "base magic".

You can have a look at that article as it shows a solution how to get 
accomplished what you were trying to do.

Am Donnerstag, 8. Februar 2018 17:47:04 UTC+1 schrieb Stefan Nilsson:
> Here is a short article about how to do OOP in Go with composition, 
> structurally typed interfaces and, in some special cases, embedding. I 
> believe this can often be a better approach than traditional OOP modeling 
> using inheritance. I'd love to hear you thoughts.
> Inheritance and OOP: Go one better 
> <http://yourbasic.org/golang/inheritance-object-oriented/>

You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to