different datatypes of argument, Function Overloading, Simple example of Function Overloading
Simple example of Function Overloading in C++ having different datatypes of  argument:


Program Code:
#include <iostream>
using namespace std;
int sum(int x,int y)
{
 cout<< x+y;
}
double sum(double x,double y)
{
 cout << x+y;
}

int main()
{
 sum (10,20);
 sum(10.55,20.15);
}


The output of the program is tested on www.jdoodle.com
Output:
30
30.70


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: