What is Function Overloading?
Function overloading provides a way to have multiple functions with the same name. For each call of the function, the compiler compares the number and type of the arguments in the call against the parameter lists of each version of the function.The compiler selects the appropriate version. This process is call function resolution. Overloaded functions can have different type and number of arguments. However, the return type needs to be the same.
//Code Example for function overloading
void DisplaySum(int x, int y)
{
cout<<"Programmers Heaven C++ FAQ - Integer result: "<<(x+y);
}
void DisplaySum(double x, double y)
{
cout<< "Programmers Heaven C++ FAQ - Double result: "<<(x+y);
}
void DisplaySum(float x, float y)
{
cout<< "Programmers Heaven C++ FAQ - float result: "<<(x+y);
}
C++ FAQ Home
Sponsored links
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Software Localization Tool Sisulizer
Localize DotNet, C++ Builder, Delphi, C/C++, Visual Basic & Java apps & html help. Try Sisulizer now
Localize DotNet, C++ Builder, Delphi, C/C++, Visual Basic & Java apps & html help. Try Sisulizer now
CSTSOFT Instrumentation .NET & ActiveX Components
A collection of 13 instrumentation .NET/ActiveX/VCL components including Gauge,Knob,LED,Trend etc.
A collection of 13 instrumentation .NET/ActiveX/VCL components including Gauge,Knob,LED,Trend etc.
Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.
