Summary
One feature that Go does not offer that is really useful in visitor patterns is overriding methods. The basic idea is to write a concrete class that contains all the VisitX methods with empty implementations, and a subclass can choose to only override the methods it cares about, ignoring the rest.
We’ll see an example of how to implement this pattern in idiomatic Go code.
Summary
One feature that Go does not offer that is really useful in visitor patterns is overriding methods. The basic idea is to write a concrete class that contains all the VisitX methods with empty implementations, and a subclass can choose to only override the methods it cares about, ignoring the rest.
We’ll see an example of how to implement this pattern in idiomatic Go code. […]