What's the difference between Polymorphism and Multiple Dispatch?

后端 未结 7 1348
难免孤独
难免孤独 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:46

    Multiple Dispatch is a kind of polymorphism. In Java/C#/C++, there is polymorphism through inheritance and overriding, but that is not multiple dispatch, which is based on two or more arguments (not just this, like in Java/C#/C++)

提交回复
热议问题