C + + Notes--function overloading (illegal overload cases)

Source: Internet
Author: User

It is not considered an overload in the following cases:

1. Functions with different return values cannot be considered overloaded

2. Whether the return value is static cannot be considered overloaded

3. Arrays and pointers

int fun( int *ptr); int fun( int ptr[]); // redeclaration of fun(int *ptr) 4, functions, and function pointers void h( int ()); void h( int (*)()); // redeclaration of h(int()) 5, whether the parameter is const cannot be distinguished (but is possible for class member functions) Note: The const modifier pointer parameter or reference parameter can be used as an overloaded identity, so to understand, because the pointer or reference as a formal parameter can modify the argument itself, when the Const modifier refers to the content cannot be modified, so can be used as a distinguishing overload of the identity http:/ www.geeksforgeeks.org/function-overloading-and-const-functions/ 6, whether default parameters cannot be distinguished

http://www.geeksforgeeks.org/function-overloading-in-c/

C + + Notes--function overloading (illegal overload cases)

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.