C + + NOTE-Class hierarchy

Source: Internet
Author: User

  • Multiple inheritance
      • The case that a class takes multiple direct base classes is called multiple inheritance, and a base class is single inheritance.
        • A member function with the same name may appear in two base classes
          • In a derived class, you must dissolve the ambiguity of the member functions of the two base classes, and the best way to do this is to redefine the function with the same name in the derived class. In this way, the derived class will localize the function, overwriting that function in the two base classes.
          • We can also use scoped qualifiers to find some functions that we really need. ::
      • Combine some unrelated classes, where there are many functions with the same name, and should eliminate the ambiguity of the use of these functions, and not just by the parameter type to make the function call and parse.
        • Here we can eliminate ambiguity by making use of declarations.
        •   

C + + NOTE-Class hierarchy

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.