Search your topic here

Overloaded subprograms


Subprogram means nothing but a funciton or procedure in a programming language.

An overloaded subprogram is a subprogram that has the same name as another subprogram in the same referencing environment.

A subprogram must be different from the others in the number, order, or types of its parameters, and possibly in its return type if it is a function.

The meaning of a call to an overloaded subprogram is determined by the actual parameter list (and/or possibly the type of the returned value, in the case of a function).

Overloaded subprograms have same name but not necessry have same process.

For example overloaded subprogram in C++:

#include <iostream>
using namespace std;

void show (int a) 
    cout << a ;

void show (int a, int b) 
    cout << a << b;

int main() 
    int a = 10;
    int b = 20;
    show(a, b);
    return 0;