Monday 12 September 2016

Function Overloading In C++ - Coaching Institute



Function Overloading In C++ - Coaching Institute
Welcome to TCCI-Tririd Computer Coaching Institute.
C++ is an object oriented programming language. Polymorphism is one of the most important concept of object oriented programming language. Polymorphism means more than one form.
Polymorphism contains function overloading and operator overloading.
Function Overloading:
Same function name with different signatures is called function overloading.
i.e.  int Sum(int a, int b);
int   Sum(int a, int b, int c);
These two functions are c example of function overloading.
Both have same name Sum(), but have different no. of arguments.
Let us see another example, which have different data types:
void total(int a)
{ cout<<”total=”<<a;}
void total(float b)
{ cout<<”total=”<<b;}
void total(double c)
{ cout<<”total=”<<c; }
float Sum(float a, float b);
Here, in this example no. of arguments are same but data types of data are different.
So, both are called function overloading. There are same function name but no. of arguments are different in first example, in other example no. of argument same but data types are different.
To learn Basic Of C++
Mail to tccicoaching@gmail.com
Contact us @9825618292
Get information from https://tccicomputercoaching.wordpress.com/


No comments:

Post a Comment