Function Overloading

C++ allows multiple functions with the same name but different parameters. This is called function overloading.

int add(int a, int b) {
  return a + b;
}

float add(float a, float b) {
  return a + b;
}

The compiler differentiates functions by their parameter list.

← PrevNext →