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

Board Coloring , In this problem you are given a board in which some of the...

In this problem you are given a board in which some of the elements are placed as shown in diagram below. Each element represents a color. Fill the other elements in the board, suc

Describe processing an array, Describe Processing an array? The Single ...

Describe Processing an array? The Single operations which involve complete arrays are not permitted in C language. therefore if a and b are similar arrays (for example same dim

Data structure, how to convert a general tree into binary tree with example...

how to convert a general tree into binary tree with example

Writing a c++ program, how can I write a c++ program that generate all evn ...

how can I write a c++ program that generate all evn numbers less than 1000?

Eevrv, Ask question #Mi fd d fffffffffffffffffffffffffffffffffffffffffff...

Ask question #Mi fd d fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

Give a formal expression of the specification, A function REPAT is specifie...

A function REPAT is specified below. Function REPAT(c in Char, i in Int, s in mString) return in mString pre 1 ≤ i ≤ the length of s. post The returned value is a string identic

Wap to print numbers from 1-50 which are divided by 7, WAP TO PRINT NUMBERS...

WAP TO PRINT NUMBERS FROM 1-50 WHICH ARE DIVIDED BY 7 void main () { int a; clrscr (); a=1; while (a { if (a%7==0) printf ("%d\n",a); a++; } ge

What is scope resolution operator, Scope Resolution operator: The scope...

Scope Resolution operator: The scope resolution operator: : is used to access global variable in the inner block. When global and local variable are identical name the scope re

Describe the theoretical concepts of binary files, Question 1 Explain the ...

Question 1 Explain the concept of constructors and destructors in C++ with programming examples Question 2 Explain the concepts and applications of multiple inheritance and v

The car’s measurements are illustrated, The car’s measurements are illustra...

The car’s measurements are illustrated, using two arrays. Array 1 = {L, R, L, R, R, L, R, R, L, R, R, L, R, L, L, R, Z}

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