C + + fundamentals (eight)

Source: Internet
Author: User

One, the type of the decisive

By accessing a member of a class to a pointer or reference, the compiler simply determines whether the member can be accessed based on the pointer or the type referenced, regardless of the actual target object of the pointer or reference.

Second, virtual function and polymorphism

If a member function in a base class is declared as a virtual function (preceded by its return type with the virtual keyword), the same function in its subclass is also a virtual function (whether or not it has the virtual keyword), and it forms an overlay with the base class version.

This virtual function is called by a base-class pointer to a subclass object or a reference to a subclass object, which is actually

C + + fundamentals (eight)

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.