Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Interesting - I'd never thought about using a visitor with overloading to achieve polymorphism. Would this overload correctly at runtime though? Commented Feb 1, 2013 at 14:30
  • Yes it would overload correctly. See edited answer Commented Feb 1, 2013 at 14:36
  • I can see that this works. It's a shame though that each derived class has to implement the visit() method. Commented Feb 1, 2013 at 15:21
  • This prompted me to do a bit more searching and I've now found the implementation of Loki's Visitor pattern which seems to be exactly what I'm looking for! I was familiar with the visitor pattern in terms of visiting nodes in trees, but hadn't thought of it in a more abstract manner. Commented Feb 4, 2013 at 14:48