Function Overloading is an actively used design pattern.

?Years Old

Languages without Function Overloading include javascript

Languages with Function Overloading include cpp, pascal

Example from cpp:

// volume of a cube
int volume(const int s) {
 return s*s*s;
}
// volume of a cylinder
double volume(const double r, const int h) {
  return 3.1415926*r*r*static_cast<double>(h);
}

Example from pascal:

program Adhoc;

function Add(x, y : Integer) : Integer;
begin
    Add := x + y
end;

function Add(s, t : String) : String;
begin
    Add := Concat(s, t)
end;

begin
    Writeln(Add(1, 2));                   (* Prints "3"             *)
    Writeln(Add('Hello, ', 'World!'));    (* Prints "Hello, World!" *)
end.

Last updated September 6th, 2019