1. Technology

Definition of Overloading

By

Definition: Overloading allows functions in computer languages such as C++ and C# to have the same name but with different parameters.

For example, rather than have a differently named function to sort each type of array

 Sort_Int( Int Array Type) ;
 Sort_Doubles( Double Array Type) ;
 
Instead use the same name with different parameter types.
 Sort( Int Array Type ) ;
 Sort( Double Array Type ) ;
 
The compiler is able to call the appropriate function depending on the parameter type

Operator Overloading

Similar to function overloading this allows programmers to redefine operators such as +, -, * etc. For example in a class for complex numbers where each number has a real and imaginary part, overloaded operators allow code such as this to work.
 complex c = a + b;
 
So long as + is overloaded for the type complex.

Glossary:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  1. About.com
  2. Technology
  3. C / C++ / C#
  4. Glossary
  5. Overloading - Definition and Example

©2014 About.com. All rights reserved.