Please click on ads

Please click on ads

Friday, 12 February 2021

function overloding in cpp

hey ,

today we are write a code of c++ function overloading..

 include<iostream>

using namespace std;

//function overloading

int  function(int x,int y){//first function 

return x+y;

//cout<<"hy";

}

double function(double a,double b){//second function

return a+b;

}

int main(){

int m1=function(11,343);//create an object

double m2=function(13.2332,23.32);//create an second obj for second function

cout<<m1;

cout<<m2;

return 0;

}

No comments:

Post a Comment