Function overloading

Function overloads occur when we have many functions with the same name but different arguments. The arguments can differ in number or type.

#include <iostream>
using namespace std;

void sum(int a, int b) {
	cout << a + b << endl;
}

void sum(int a, int b, int c) {
	cout << a + b + c << endl;
}

void sum(double a, double b) {
	cout << a + b << endl;
}

int main() {
	sum(5, 6);
	sum(5, 6, 7);
	sum(4.4, 7.6);
    
	return 0;
}
Output
11
18
12