Function Overloading in C++

🟢 Beginner

📖 Definition

Function overloading allows multiple functions in the same scope to share the exact same name, provided their parameter types or parameter counts differ (compiler mangled signatures).

💡 Code Example

#include <iostream>

int multiply(int a, int b) { return a * b; }
double multiply(double a, double b) { return a * b; }

int main() {
    std::cout << "Int Product: " << multiply(4, 5) << "\n";
    std::cout << "Double Product: " << multiply(2.5, 4.0) << "\n";
    return 0;
}