I read a book about the visitor pattern. It gives the same class diagram as in the oodesign\'s website.
It says that adding new ConcreteElement classes is hard. But I di
Essentially, visitor pattern is kind of data manipulator, it will
In one word, visitor pattern will extend the system functionality, without touch the element class definition.
But does this mean the visitor class must be revised if new concrete element class is added? It depends, I believe, on how the visitor pattern is designed and implemented.
If separate all the visit methods of visitor into visit functors, and dynamically bind the them together, then it might be easier when extending the how system, for both visitor and visitee.
Here is an implementation of visitor pattern I wrote several years ago, the code is a bit old and not well polished, but somehow works :)
https://github.com/tezheng/visitor