Function Overloading in Cpp 2022
Functions Overloading in Cpp 2022
//......Mymixindia.com.........
//........Function overloading program.....
#include <iostream>
using namespace std;
void add_function(int a){ //.....function with one parameter....
cout<<"The result of a+a is = "<<a+a<<"\n";
}
void add_function(int a, int b){ //.....function with two parameters....
cout<<"The result of a+b is = "<<a+b<<"\n";
}
void add_function(int a, int b, int c){ //.....function with three parameters....
cout<<"The result of a+b+c is = "<<a+b+c<<"\n";
}
int main() {
add_function(18); //.....calling function having one parameter....
add_function(24,32); //.....calling function having same name but having two parameters....
add_function(24,23,25); //.....calling function having same name but having three parameters....
return 0;
}
The output of the above program
The result of a+a is = 36 The result of a+b is = 56 The result of a+b+c is = 72
Related Posts:
Pointer Program with Aaary and Function in Cpp 2022
Program to Print Prime Number in CPP 2020
5 Namespace Program in C++ 2022