Is C# a single dispatch or multiple dispatch language? -


I'm trying to understand what exactly is a single dispatch, okay.

I've read it:

And by that definition I think that C # and VB.Net are multiple-remittances, even if the option of the compilation that calls at the time of compilation is done.

Am I right here, or am I forgetting something? Thanks!

OK, I'm considered a subtle difference where the function overloading is different from multiple dispersion.

In fact, the difference is that what method is chosen to call at run-time or compile-time Now, I know that everyone has said this, but without a clear example It seems very obvious that C # is statically typed and many sending languages ​​(apparently me, at least) are dynamically typed. So far, with just this definition-many dispatch and function overloading made me feel right.

In the case that makes this a real difference, when you have a 2 overload of a method that varies on type of one parameter, but 2 types are polymorphic, and you have a higher reference Make a call with the declared context, which is one of the following types of objects ... (If someone can think better to express it, please edit this answer)

Example:

  integer cache Chr Spesship (Aiarabielalaynsship ship) {} Ant capture Spesship (Aksving vessel) {} void main () {IRebelAllianceShip theShip = new XWing (); CaptureSpaceShip (theShip); }  

Xwing explicitly implements IRBL alignments. In this case, the first method will be called, whereas if several remittances have been applied to C #, then the second method will be called.

Sorry about the rebirth of the doctor ... this is the most obvious way of explaining to me.

For more formal explanation:


Comments