Education

Function Overloading In C++

TCCIWelcome 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; }

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++

For More Information About

c++ course at tccicomputercoaching.com, tcci-ahmedabad, computer classes in Ahmedabad, computer courses, function overloading

Leave a comment