Computer Science, asked by sukhmaniA4733, 10 months ago

What are the Function Overloading In C++

Answers

Answered by theophilussam11
0

Explanation:

Function overloading is a feature in C++ where two or more functions can have the same name but different parameters. Function overloading can be considered as an example of polymorphism feature in C++.

#include <iostream>

using namespace std;

  

void print(int i) {

  cout << " Here is int " << i << endl;

}

void print(double  f) {

  cout << " Here is float " << f << endl;

}

void print(char const *c) {

  cout << " Here is char* " << c << endl;

}

  

int main() {

  print(10);

  print(10.10);

  print("ten");

  return 0;

Output:

Here is int 10 Here is float 10.1 Here is char* ten

Answered by THUNDERBOLT007
0

Answer:

Function overloading is a feature in C++ where two or more functions can have the same name but different parameters. Function overloading can be considered as an example of polymorphism feature in C++.

#include <iostream>

using namespace std;

  

void print(int i) {

  cout << " Here is int " << i << endl;

}

void print(double  f) {

  cout << " Here is float " << f << endl;

}

void print(char const *c) {

  cout << " Here is char* " << c << endl;

}

  

int main() {

  print(10);

  print(10.10);

  print("ten");

  return 0;

Output:

Here is int 10 Here is float 10.1 Here is char* ten

Similar questions