Hi Marcos,
Thanks very much for helping with my question.
Correct me if I'm wrong. With the example you provided, there is no
way to define specific version of Do2 method for Task1 and Task2, that
is, the implementation of Do2 is fixed with Doer2 struct. To have such
flexibility, the Do2 method must be polymorphic, so in Go there has to
be an interface embedded in struct Task1 and Task2, and this interface
is initially nil and has to be assigned, which turns out again to be
the approach that I have posted initially.
Regards,
Hǎiliàng
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/golang-nuts/kpLtsPk3f1c/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
>
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.