Function Overloading:
Function Overloading means using the same function name for more than one function, but the functions signature must differ. Funtion Signature means - the no. of parameters, the type of parameters and/or sequence of parameters passed. For example, the following function will be called as overloaded:
void Add(int,int);
void Add(int,float);
void Add(float,int);
void Add(int, int, int);
For all these functions, either the no of parameters are different or the type or the sequence is different.
Look at the following functions:
void Add(int, int);
int Add(int, int);
These functions are not overloaded as the signature of the functions are same, only the return type is different. If you compile this, you will get error message.
Function Overiding:
==================
Function Overiding is the process of redefining the base class function in its derived class. This can be used if you are using classes and you want to change the functinality of the base class function in the derived class. Ex:
class base
{
void add()
{
cout<<"Add";
}
}
class d:public A
{
void add()
{
cout<<"Derived";
}
}
Function add() is said to be overidden in the derived class d.