Function overloading
It refers to using the same
function name to perform the varity of
different function
The difference in the
Function call is made on the Basis of the following methods:
(1) Number of arguement
(2) Type of arguement
(3) Sequence of arguement
consider the following
program:
#include <iostream.h>
#include <conio.h>
void area( int side)
{
cout<<"Area of
Square "<<side*side;
}
void area ( int length,int
width)
{
cout<<length*width;
}
void area ( double radius)
{
cout <<3.14*radius*radius;
}
void main()
{
area(5,6);
area(8);
area (5.6);
getch();
}
No comments:
Post a Comment