About overrides in C + +, overloading, hiding a little note

Source: Internet
Author: User

C + + overlay overload concealment is a three often confusing concept

Here we summarize briefly below:

1. Overloaded conditions (compile-time polymorphism)

A. In the same class

B. The function name is the same, the parameters are different (the return value cannot be an overloaded condition)

C. Independent of whether the function is a virtual function

2. Conditions of coverage (run-time polymorphism)

A. In different classes, it is often an inheritance system

B. Base class The function is a virtual function

C. Derived class function names are the same, parameters are the same

3. Hidden conditions

A. In different classes, it is often an inheritance system

B.1 If the function name in the inheriting class is the same, the arguments are different, regardless of whether the function is a virtual function in the base class, hidden

B.2 if the function name in the inheriting class is the same, the parameter is the same, and the function is hidden only if it is not a virtual function in the base class.

About overrides in C + +, overloading, hiding a little note

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.