answersLogoWhite

0

"Overloading" a function means that you have multiple functions with the same name, but different signatures. The signature of a function is its return type and number/types of parameters.

For example:

void foo(int a, char b)

can be distinguished from

void foo()

which can be distinguished from

void foo(double a)

which can be distinguished from

void foo(int a)

The program will call the correct function based off of the number and types of parameters it is given. So:

foo(1) will call the 4th example

foo(1.0) will call the 3rd example

foor() will call the 2nd example

and foo(1, 't') will call the 1st example

Note that MOST programming languages do not allow you to distinguish between function signatures by return type, thus:

void foo()

and

int foo()

is not allowed.

Function overloading should not be confused with function overriding. Overriding involves inheritance and is related to polymorphism.

User Avatar

Adolfo Adams

Lvl 10
4y ago

What else can I help you with?

Continue Learning about Engineering

What is the inverse time of the thermal overload?

what is the inverse time of the theraml overload?


What is the cause of the compressor if not trip to its overload?

What is the cause of a compressor if not trip to its overload


What is a heater overload?

overload heater is used to protect a large electric motor. If the overload heater get too hot from excessive current. its nomally-closed overload contacts wil open. interruptting the circiut of powe supply of motor


What is transient overload?

Sustained overload is overload that is continuous, or permanent. A resistive load is a good example. This is the kind of overload you get from simply plugging too many items into a circuit. Transient overload is overload generated by a reactive load, a momentary short circuit, or other temporary condition. An example of a reactive load is the compressor of an air conditioner starting. This kind of overload can be caused by a reactive load being added to an already moderately loaded circuit.


What is overload and is overload is good or bad?

Overload refers to a situation where an individual or system is subjected to more demands than it can handle effectively, leading to stress or decreased performance. In the context of exercise, overload is a principle that promotes muscle growth and strength by requiring the body to adapt to increased resistance or intensity. While overload can be beneficial for growth and improvement when managed appropriately, excessive overload without adequate recovery can lead to burnout or injury, making it important to find a balance. Ultimately, whether overload is good or bad depends on the context and how it is applied.