Go isn't polymorphic, whenever your String() function is called, it's on
BaseFoo, you have to do it like this:
https://play.golang.org/p/69rw0jRPalz
On Fri, May 8, 2020 at 1:43 PM Glen Newton wrote:
> Thanks!
>
> Oh no, when I try that here: https://play.golang.org/p/RV-S4MJWYUi
> Did not work:
Thanks!
Oh no, when I try that here: https://play.golang.org/p/RV-S4MJWYUi
Did not work: similar results: instead of:
BaseFoo
BaseFoo
BaseFoo
BaseFoo
now I get:
main.BaseFoo
main.BaseFoo
main.BaseFoo
main.BaseFoo
Other suggestions? :-)
Thanks,
Glen
--
You received this message because you a
On Fri, May 8, 2020 at 1:34 PM Glen Newton wrote:
>
> I would like to get the name of the struct implementing an interface (using a
> method in the interface). I could just have the MyInterface.StructName()
> method in each implementing struct which just did a return "myname" but I
> would pref
Hello,
I would like to get the name of the struct implementing an interface (using
a method in the interface). I could just have the MyInterface.StructName()
method in each implementing struct which just did a return "myname" but I
would prefer to do this using reflection and without having to