Programming error (function overloading), ajaxerrorfunction

Source: Internet
Author: User

Programming error (function overloading), ajaxerrorfunction

Here is the definition of function overloading:


Function overloading or meth overloading is the ability to create multiple methods of same name with different implementations:


Here is an example, (in C ++)

# Include <iostream>

// Volume of a cube
Int volume (int s)
{
Return s * s;
}

// Volume of a cylinder
Double volume (double r, int h)
{
Return 3.14 * r * static_cast <double> (h );
}

// Volume of a cuboid
Long volume (long l, int B, int h)
{
Return l * B * h;
}

Int main ()
{
Std: cout <volume (10 );
Std: cout <volume (2.5, 8 );
Std: cout <volume (100, 75, 15 );
}


Then it will shows that the "function overloading ";


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.