Skip to content
AgileLogics
3 min read

Function Overloading

Prerequisites: Functions and default arguments

Like Java, C++ lets several functions share a name as long as their parameter lists differ — resolved entirely at compile time:

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

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

C, notably, does not support this — it's one of the features that genuinely separates C++ from C rather than just extending it.