Overloading of Functions

Function overloading is the process of creating multiple functions with the same name but distinct arguments, values, or iterations. There are now a few conditions, and any quantity of functions bearing the same name that follow any of these is referred to as overloading.

Distinct parameter data types with the same name

Example

float sum(int a, int b);
float sum(float a, float b);

The same name, but with various parameters

Example

float sum(int a, int b);
float sum(int a, int b, int c);

Similar name, different parameter order.

Example

float sum(int a, float b);
float sum(float a, int b);

When looking for a function that has the same set of parameters, exact matches are always preferable.

Shubhajna Rai
Shubhajna Rai

A Civil Engineering Graduate interested to share valuable information with the aspirants.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in