On Tue, Jan 2, 2018 at 8:56 AM, Ian Lance Taylor <i...@golang.org> wrote:
> On Mon, Jan 1, 2018 at 8:13 PM, Tong Sun <suntong...@gmail.com> wrote: > > >> > >> Then your WalkBody function will take a TokenVisitor, and your > >> different types will implement different VisitToken methods. > >> > >> (I see that you said WalkBody method, but you probably want a WalkBody > >> function instead.) > > > > > > I did meant WalkBody method. See: > > > > https://github.com/suntong/lang/blob/master/lang/Go/src/ > xml/htmlParserTokens.go#L54 > > I understand that you asked for a WalkBody method. I'm trying to say: > Go is not C++ or Java. Go does not have virtual methods. It has > interfaces. The natural way to use an interface is to write a > function. You can use a method, but to make it work the way you want > you'll have to pass a value of the type into the method. So you may > as well use a function. > Oh, now I understand what you meant. So it's a hibrate solution. Thanks Ian. Hmm... wait, I think what I meant to ask was not answered. I'll ask again in a different thread. -- 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.