Names of C + + subclasses and parent class member functions

Source: Internet
Author: User

1 the subclass and parent return value parameters are the same, the function name is the same, and the virtual keyword is the type of the object that determines which function is called.

2 Subclass and Parent class as long as the function name is the same, there is no virtual keyword, the object of the subclass has no way to call a function with the same name as the parent class , the parent class has a function with the same name hidden, or a function with the same name can be forced to call the parent class Class::funtion_name .

3 Subclass and Parent parameters are different, the function name is the same, there is the virtual keyword, there is no polymorphism , the object of the subclass has no way to call the parent class with the same name function , The parent class has the same name function is hidden, You can also force calls to the parent class with the same name function class::funtion_name.

4 Subclass and Parent class return value is different, parameter is same, function name is same, there is virtual keyword, error C2555 compiler does not allow function name parameter same return value different function overload.

Names of C + + subclasses and parent class member functions

Related Article

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.