English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

And can you give me the example? Without code, just conception. I just want to understand the meaning.

2006-11-26 18:59:39 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

if u dont have this, while writing programs u have to look at the available functions
for example,

finding absolute of a number
if there is no overloading concepts, u have to give different names
like
float fabs()
integer iabs()
double dabs()

User has to remember this.
if u have overloading, no need to worry, directly they can use abs()
no matter what datatype it is

2006-11-26 21:38:10 · answer #1 · answered by smartsuman2k1 2 · 0 0

Overloading a function allows you to do several things with one function based on the arguments given to it.

Example:
You have a function Count that accepts an int. The function prints 10 numbers starting with the number you gave it and incrementing by 1.

You have another function Count that accepts two ints. This function prints 10 numbers starting with the first number you gave it and incrementing by the second number you gave it.

You have another function Count that accepts an int and a string. This function prints the number, then the string, then increments the number by 1 and keeps going until it has printed 10 numbers and strings.

The Count function is overloaded because it can accept more than one argument or type of argument.

2006-11-27 03:10:27 · answer #2 · answered by Bryan A 5 · 0 0

function overloading means 2 or more functions with same name but different no and types of parameteres and return types

eg int fun(int a);

float fun(int a,float b);

this concept is basically used wen many functions have to perform a single thing but return different things or take diff things

2006-11-27 03:07:57 · answer #3 · answered by aravind 3 · 0 0

fedest.com, questions and answers