What's the difference between Polymorphism and Multiple Dispatch?

后端 未结 7 1368
难免孤独
难免孤独 2021-01-30 10:52

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

<

7条回答
  •  情话喂你
    2021-01-30 11:38

    Multiple Dispatch is more akin to function overloading (as seen in Java/C++), except the function invoked depends on the run-time type of the arguments, not their static type.

提交回复
热议问题