Avoid hiding the inherited name-Objective C ++ Study Notes

Source: Internet
Author: User

Avoid that the name of the public function in the subclass is the same as the inherited name.

The Search Condition Based on naming rules is similar to that where global variables and local variables have the same name as global variables. When the names in the subclass are the same as those in the accumulation, the names of the base classes are implemented, whether the subclass name is private or public.

At the same time, parameters with the same name are blocked.

You can use using
Base: Name to solve this problem.

However, it is best not to duplicate names.

Remember:

1)
The names in the derived class mask the names in the base class. No one ever wishes to do this under public inheritance.

2)
You can use the using name or the transfer function to recreate the days for the masked name.

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.