3 ms·
Can someone more intelligent than me explain how multiple dispatch differs from function overloading?
by rco8786 4y ago
Can someone more intelligent than me explain how multiple dispatch differs from function overloading?
- MarkSweep 4y agoIn function overloading, like in Java or C#, the method is picked at compile time based on the static types of the parameters. In multiple dispatch, the function is chosen at runtime based on the runtime type of the parameters.
- KenoFischer 4y agoDynamic mutliple dispatch takes into account the dynamic type rather than the static type as you would in say-C++ style function overloading. The single dispatch equivalent is function overloading vs virtual calls.