Clause 36: Never redefine, inherited non-virtual functions

Source: Internet
Author: User

Redefining an inherited non-virtual function may cause the function to be called when it is called, not depending on the object to which the called function belongs, but rather depending on the pointer to the function being called or the type of reference.

So generally speaking there are two main points of view in this respect: 1. If d is not a function to be re-inherited, then it may be that their relationship is not suitable for public inheritance, because the nature of the public inheritance is is-a, then there will be no previous kind of the said situation 2. On the other hand, this function may also have a problem with the declaration, as the virtual function may be more suitable for his intended

Clause 36: Never redefine, inherited non-virtual functions

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: 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.