C++/Function overloading

In object oriented programming language the flexibility of using the polymorphism features are achieved by function overloading.Basically it is the process of using the same function name for two or more functions,but the functions need to have different types of parameter or different numbers of parameters to be used in the program. Examples :: #include using namespace std; int sqr(int); float sqr(float); main {  int a=15; float b=2.5; cout<<"square= "sqr(a)<<"\n"; cout<<"square= "<<sqr(b)<<"\n"; return 0; } int sqr(int s) { return (s*s); } int sqr(float j) { return (j*j); }

OUTPUT: square=225 square=6.25