Single Dispatch and multiple dispatch

Source: Internet
Author: User

The type of the caller of the method (the parent type) is called a static type. The caller's final type (its own type) is called the actual type.

This allocation is called multi-Dispatch when the version of the method is determined by the type in the caller's actual type + method parameter to determine the method version. Just based on the caller and method parameters, called single dispatch.

Dispatch is the point of view of determining the method version by type.

Java is a static multi-dispatch, dynamic Single-Dispatch.

First, static allocations occur during the compilation phase. In the compile phase, if you want to determine the version of the method, you need to know the actual type of the caller and the parameter type. So it's multi-tasking.

Multi-Dispatch occurs at compile-time, at which point the actual type of the parameter is known after compilation, so it is only possible to know the actual type of the method caller to determine the unique version of the method, so the dynamic dispatch must be a single dispatch.

Single Dispatch and multiple dispatch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.