Explain function overloading, C/C++ Programming

Assignment Help:

Function Overloading

Function overloading is a form of polymorphism. Function overloading facilitates explaining one function having many forms. In other words it facilitates explaining several functions with the same name, thus overloading the function names. Like in operator overloading, even here, the compiler uses context to verify which definition of an overloaded function is to be invoked.

Function overloading is used to define a set of functions that essentially, do the similar thing, but use different argument lists. The argument list of the function is also call as the function's signature. You can overload the function only if their signatures are dissimilar. 

The differences can be

 1. In number of arguments,

 2. Data types of the arguments,

 3. Order of arguments, if the number and  data types of the arguments are similar.

e.g.

                                int add( int, int );

                                int add( int, int, int );

                                float add( float, float );

                                float add( int, float, int );

                                float add(int,int,float);  

 


Related Discussions:- Explain function overloading

Explain the function of five elements that are on a, explain the function o...

explain the function of five elements that are found on a motherboard#

Graphics, demonstrates shearing about origin

demonstrates shearing about origin

Write a program of inline function, Here is a program that uses an inline f...

Here is a program that uses an inline function to compute and return the absolute value of its input argument. # include inline int abs(int x) {                  ret

Programming assignment, Introduction. In this assignment you are required t...

Introduction. In this assignment you are required to simulate a maze traversal using so called recursive backtracking (the algorithm is given below). The grid of #s and 0s in the f

Float number, We can combine more than one variable on the same line i.e. ...

We can combine more than one variable on the same line i.e.   float number1,number2,number3; etc Sometimes we want to mix the variable types used on the same line, this could

Addition of array elements, Addition of array elements: #define rows 3 ...

Addition of array elements: #define rows 3 #define cols 3 void main() {                 int i=0,j=0,sum=0;                 int arr[rows][cols];

Explain static variables, Static Variables Static variables have the si...

Static Variables Static variables have the similar scope s automatic variables, but, unlike automatic variables, static variables retain their values over number of function ca

Strings, A string S is said to be "Super ASCII", if it contains the charact...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Strings, A string S is said to be "Super ASCII", if it contains the charact...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd