function Overloading/declare function

Source: Internet
Author: User

    • Declare a function

To declare a function without identifying the argument list, you can do it on this is:

void Say hello (...);

Here, your use of three point(...) to indicate that the function has no argument.

    • function overloading

The Keep in mind is the signature, not the function type, enables function overloading. For example, the following and declaration are incompatible:

long Gronk (int n, float m); #1//same Signature   

double Gronk (int n, float m); #2//hence not allowed  

Why, for example, if the is possible:

int hel=0;

float haa=3;

Gronk (Hel, haa); //which function to use, #1 or #2, it is conflict.

Therefore, C + + doesn ' t allow the overload Gronk () in the This fashion. You can have different return type, but only if the signature is also different, for example:

Long Gronk (int n, float m);

Double Gronk (double N, double m); //now It is allowed

function Overloading/declare function

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.