3. A function name having several
different definitions that are
differentiable by the number or type
of their arguments,is known as an
OVERLOADED FUNCTION and this
process is called FUNCTION
OVERLOADING.
4. Functions to be overloaded must
have
same name.
their parameter list must vary in:
1.in terms of number of
arguments.
2.in type of arguments.
6. Different number of parameters
int Function(int a) {}
int Function(int a,char b)
{}
int Function(int a,float b,
long c) {}
7. 1.While creating functions with same
name if the signatures of subsequent
functions match the previous
function’s,then the second is treated
as REDECLARATION of the first.
For example:
void square(int a,float b);
void square(int x,float y);
8. 2.While creating functions with same
name if the signatures of the two
functions match exactly but the return
types differ,the second declaration is
treated as an erroneous re-declaration
of the first and is flagged at COMPILE
time as an error.
For example:
float happy(float f);
double happy(float x);
9.
10.
11. Class abc { void main()
int x;float y;
{
public: clrscr();
int max(int a,int b) float d;int c;
{ abc o1,o2;
if(a>b) c=o1.max(5,6);
return a; printf("%d",c);
else
return b; } d=o2.max(10.0001);
float max(float a) printf("%f",d);
{ getch();
if(a>10) }
return a;
else
return 10.00;}};
13. Can perform variety of
functions with same function
name.
No need to remember name of
many functions.
14. Functions should have
different argument lists.
Member functions cannot be
overloaded solely on the basis
of one being static and the
other being non static.
15. C++ Sumita Arora 11th class.
C++ Sumita Arora 12th class.
Object –Oriented Modelling and
Design with
UML-James RumBaugh.
Masters in C and C++ .
OOP with Balaguruswamy.