Thursday, May 21, 2020

Function Overloading in C++


  • Program :

#include <iostream>
using namespace std;
int c(int x, int y)
{
  return x + y;
}

double d(double x, double y)
{
  return x + y;
}

int main()
{
  cout <<"\n----------------FUNCTION OVERLOADING----------------\n";
  int a = c(8, 5);
  double b = d(4.3, 6.26);
  cout << "Int: " << a << "\n";
  cout << "Double: " << b;
  return 0;
}




  • Output :


No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...