Method Overloading

September 10th, 2006 Admin Posted in Method Overloading No Comments »

Method Overloading

The methods that have same name and different signatures are called overloaded

The method signature  tells about its  no. of parameters &  their types.It doesn’t concerns about it’s return type.

Example 1:  Argument list should  differ

int   add(  int a ,  int  b )
double  add (  double a,  double  b  )

Example 2:  Return type doesn’t  come in the picture. The following methods are not  over-loaded.

void   test (  int a ,  char  b )
int     test (  int a,   char  b  )

The compiler generates the error message.

AddThis Social Bookmark Button