1. Function Overloading in C++

### Structure of the Problem Requirements

In this problem we will learn how to overload a function in C++ programs. Function Overloading is a process in which we define a function with same name but their arguments (parameters) are different according to the data types . Function can also be overload with increasing or decreasing the number of arguments in a function. Remember Complier chose the function according to the input when it deal with overloaded functions. In this Problem we have a function of sum and we manipulate it with three different data types . Here is the Source Code of this Problem which help you in better understanding .

## Source Code

#include<iostream>

using namespace std;

class Function_overloading

{

public:

void calculate (int a,int b)

{

cout<<" SUM IS : " <<a+b;

}

void calculate (double a,double b)

{

cout<<" SUM IS : " <<a+b;

}

void calculate (float a,float b)

{

cout<<" SUM IS : " <<a+b;

}

};

int main ()

{

Function_overloading f;

f.calculate(24,45);

cout<<endl;

f.calculate(45.3,67.68);

cout<<endl;

f.calculate(1234567,7654321);

}

## Output of the Program

Overloaded Function |

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

## 0 comments:

## Post a Comment