double-dispatch

Double dispatch in C#?

I have heard/read the term but don't quite understand what it means. When should I use this technique and how would I use it? Can anyone provide a good code sample? ...

What's the difference between Polymorphism and Multiple Dispatch?

...or are they the same thing? I notice that each has its own Wikipedia entry: [1] [2], but I'm having trouble seeing how the concepts differ. Edit: And how does Overloading fit into all this? ...

Double dispatch/multimethods in C++

I have a question on C++ double dispatch. In the code below, I want the results from the second set to match the results from the first set. I don't know the actual type (unless I try dynamic_cast) but I do know that the object inherited from the BaseClass type. What is the most efficient (performance-wise) way to accomplish this? Aft...

c++ double dispatch with mirrored hierarchies

Hi, the following class hierarchies represent abstract resource handler and resource hierarchies. Both have the interfaces as base classes. Now imagine you write a system where you can implement multiple specific resource systems under these interfaces. Here is just one example. The specific main class creates the resources derived from ...

method with two parameters which both need to be double dispatched

lets say i have a method which has two parameters. i have been implementing them as: if(aObj instance of Marble) { if(bObj instance of Bomb) { this.resolve((Marble)aObj,(Bomb)bObj); } } as you can see its not a very pretty solution. i plan to implement using double dispatching, but with two parameters which both need d...

Visitor pattern lacking parameters

I'm sure this must be a common problem with the Visitor pattern, so thought I'd see if there is a standard solution. How can you re-code a tree traversal where the methods are built into the tree classes themselves, say class Node { void Traverse(SomeType& t) { ... } }; into code that uses a visitor. Two solutions that come to mi...

What is Single and Double Dispatch ?

Hello to all, i have wrote the visitor pattern as follow but i don't understand what is single and double dispatch. AFAIK, single dispatch is invoke a method based on caller type where double dispatch is invoke a method based on caller type and argument type. I guess double dispatch is happen in single class hierarchy but why visitor ...

operator== with double dispatch in C++

How should one implement operator==(const Base& base) to compare subclasses s.t. the calls would be properly dispatched when called as Base* base1 = new Derived1(); Base* base2 = new Derived2(); base1->operator==(*base2)? ...