Labs ICT
๐ŸŽ“ SIWES/IT Login

Function Overloading

1 min read | C++ Tutorial
๐ŸŽ“

Doing SIWES / IT attachment?

Get a structured training programme, a supervised digital logbook, and a completion certificate with LabsICT SIWES / IT.

Explore SIWES / IT Training

Function Overloading

You can have multiple functions with the same name as long as their parameter lists differ in number, type, or both. The compiler picks the right one based on the arguments.

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

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

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

The return type alone isn't enough to distinguish overloads โ€” the parameters must be different. This is called overload resolution.

Overloading makes your API consistent. Instead of addInt, addDouble, addThree, you just write add.

๐Ÿงช Quick Quiz

What is function overloading?