Explain function overloading, C/C++ Programming

Function overloading:

Functions can be defined with same name.  Depending upon the type of argument passed

the function will perform.  This is known function overloading.  It may look like calling the same function but really it is not. This is also called as function polymorphism.

int f_over(int x);

float f_over(float a, float b);

void main( )

{int a=10;

float x=11.11,y=22.2,z;

c =f_over(a); //The value of c is 10

}

int f_over(int x);

{return (x)

};

float f_over(float x, float y)

{return (x/y);

}

Posted Date: 9/20/2012 7:49:47 AM | Location : United States







Related Discussions:- Explain function overloading, Assignment Help, Ask Question on Explain function overloading, Get Answer, Expert's Help, Explain function overloading Discussions

Write discussion on Explain function overloading
Your posts are moderated
Related Questions
When I develop a destructor, do I require to explicitly call the destructors for my member objects?

how objects are initialized dynamically?

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

A: A reference has to always refer to some object and, so, must always be initialized; pointers do not have such limits. A pointer may be reassigned to point to distinct objects wh

Of course it is C[i] = A[i] + B[i].It was a typing mistake,never mind. You just understand the concept. 27-1 b. for grain-size=1 n=A.length grain-size=1 r=n for

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

A: No. (Excluding if you have an old compiler, you might have to force the new operator to throw an exception if it runs out of memory.) This turns out to be a real pain to alwa

write aprogram for random -search to implement if a[i]=x;then terminate other wise continue the search by picking new randon inex into a

what is a variable

#include stdio.h   struct  complex   {   float real;   float imag;   };   struct complex complexadd(struct complex,struct  complex);   void main()     {          Date: 26