double-dispatch Questions

4

Solved

I try to understand how double dispatch works. I created an example where a monster and a warrior derived from the abstract class Creature could fight. The class Creature has method "fight", which ...
Stomato asked 25/9, 2012 at 11:29

5

Solved

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?
Downwind asked 3/9, 2008 at 21:3

4

Solved

I was looking into other questions related to the visitor pattern but couldn't understand the implementation of double dispatch in visitor pattern. Please refer to the link Visitor Pattern How d...

1

Solved

Could someone please explain the process of double dispatch in Pharo 4.0 with Smalltalk? I am new to Smalltalk and am having difficulty grasping the concept, since it is implemented very differentl...
Malpractice asked 15/6, 2015 at 17:56

3

My question is about implementing different behaviours for different messages in an as extensible way as possible. I am aware of the visitor pattern, I am aware of double-dispatch, but I can't seem...
Spinescent asked 6/3, 2015 at 15:44

1

Solved

As I understand it, in the typical specification of the Visitor pattern, it is the visited objects that decide how to traverse, and generally, they only support one traversal order. (See, e.g., her...
Chablis asked 4/7, 2014 at 2:13

7

Solved

I have following C# code. It works fine; but the GetDestination() method is cluttered with multiple if conditions by using is operator. In .Net 4.0 (or greater) what is the best way to avoid thes...
Cardboard asked 21/1, 2014 at 14:54

3

Solved

I'm trying to code a packet listener for a little server. I'm very new to Java and this is the first time i mess around with networking. The whole idea it's recive the packet, match the packet id w...
Napper asked 9/1, 2014 at 21:54

3

I'm having trouble extending an application. It is an attendance record system. Currently each employee records attendance by a card that has a QR code. Now they want to add fingerprint recognition...
Yovonnda asked 25/4, 2013 at 15:56

4

Solved

I have a C++ code where I compare different class deriving from a common mother class, Foo. If the two class have not the same type, the comparison is always false. Otherwise, it compares some inte...
Flowerdeluce asked 24/4, 2013 at 8:1

5

In the following, I want EventHandler to handle EventA one way, EventB another way, and any other Events (EventC, EventD) yet another way. EventReceiver receives only a reference to an Event and ca...
Wrinkly asked 19/1, 2011 at 15:50

1

Solved

Consider the following hierarchy: class Base { virtual void Method() = 0; virtual void Accept(Visitor *iVisitor) = 0; }; class Derived1: public Base { virtual void Method(){//impl} virtual voi...
Juliettejulina asked 6/7, 2012 at 15:59

5

Solved

What is the difference between Double Dispatch and the Visitor Pattern?
Emerick asked 22/3, 2012 at 7:35

4

Solved

I am trying to find a better way to handle some growing if constructs to handle classes of different types. These classes are, ultimately, wrappers around disparate value types (int, DateTime, etc)...
Erythritol asked 29/2, 2012 at 16:30

5

Solved

I am currently developing a game in Scala where I have a number of entities (e.g. GunBattery, Squadron, EnemyShip, EnemyFighter) that all inherit from a GameEntity class. Game entities broadcast th...
Quorum asked 20/12, 2011 at 19:1

6

Solved

Imagine I have abstract base class Shape, with derived classes Circle and Rectangle. class Shape {}; class Circle : public Shape {}; class Rectangle : public Shape {}; I need to determine if two...
Draughtsman asked 12/9, 2011 at 20:16

5

Solved

Does anyone know a way to have double dispatch handled correctly in C++ without using RTTI and dynamic_cast<> and also a solution, in which the class hierarchy is extensible, that is the base cl...
Phraseology asked 14/6, 2011 at 14:27

5

Solved

I know what Visitor Pattern is and how to use it; this question is not a duplicate of this one. I've got a library where I put most of the reusable code I write, and which I link to most of my p...
Godliman asked 14/11, 2010 at 12:20

2

Solved

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...

2

Solved

Can anybody explain in detail the reason the overloaded method print(Parent parent) is invoked when working with Child instance in my test piece of code? Any pecularities of virtual methods or met...
Schexnayder asked 8/5, 2010 at 13:14

4

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_cas...

7

Solved

...or are they the same thing? I notice that each has its own Wikipedia entry: Polymorphism, Multiple Dispatch, but I'm having trouble seeing how the concepts differ. Edit: And how does Overloadin...
Tridentum asked 24/9, 2008 at 2:20
1

© 2022 - 2024 — McMap. All rights reserved.