1. Home
  2. Computing & Technology
  3. C / C++ / C#

Definition of Overloading

By David Bolton, About.com

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
Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.