Reputation: 2169
Is there any difference between double dispatch and visitor pattern?
I'm working with Java and C++ and wondering if there is any split between the two.
Upvotes: 1
Views: 498
Reputation:
The visitor pattern is a means of adding a new operation to existing classes. Double dispatch is a means of dispatching function calls with respect to two (or, when generalised, more) polymorphic types, rather than a single polymorphic type, which is what languages like C++ and Java support directly.
Upvotes: 2