#include <iostream>
using namespace std;
// we creating a function
void printMyName(){
cout<<"Vikas"<<endl;
}
// 2nd function we create for subtract
int sub(int x ,int y ){
return x-y;
}
// now overloading a function
// in overloading we create same name function and store some more arguments called fn overl..
int sub(int x,int y ,int z){
return (x-y-z);
}
int main() {
// calling a function
// call fun..by name
printMyName();
// calling a 2nd function
// or call a function by value
cout<<sub(45,7)<<endl;
// call a function by reference
int a =22; // in this we directly not put value
int b= 55; // we put the address of the integer in function
cout<<sub(a,b)<<endl;
//calling overloading fn..
cout<<sub(34,5,6)<<endl;
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: