An overloaded subprogram is a subprogram that has the same name as another subprogram in the same referencing environment. Every incarnation of an overloaded procedure must have a unique protocol; that is, it must; be different from the others in the number, order, or types of its parameters, or in its return type if it is function. The meaning of a call to an overloaded subprogram is determined by the actual parameter list (and/or the type of the returned value, in the case of a function).
C++ and Ada allow their subprograms to be overloaded. For example, Ada programs often have several versions of the output function PUT available to them. The most common versions are those that accept string, integer, and floating-point type values as parameters. Because each version of put has a unique parameter type, the compiler can disambiguate occurrences of calls to PUT by the different type parameters.
Users are allowed to write multiple versions of subprograms with the same name in Ada and C++. Although it is not necessary for such subprograms to provide basically the same process, they usually do. For example, a particular program may require two sorting procedures, one for integer arrays and one for floating-point arrays. They both can be named SORT, as long as the types of their parameters are different. In the following skeletal Ada program, two procedures named SORT are included