View Single Post
Old 10-28-2009, 01:31 AM   #2 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Overloading is for ambiguous functions. If you have a function with a lot of parameters that can do a lot of things, you may want other functions with less arguments that do less things. When I write overloaded functions they almost always use that "main" function with only what I need transferred over and other constant factors automated.

For example, one program I wrote had a circle drawing function. The circle could be an RGB color and at any given position on the screen. It could also have a border around it that is as wide as you want and any RGB color, same as a center. This is a lot of arguements, I had overloads to make a simple solid color circle where it only asks for the R,G,B,x and y values and fills the rest with zeros. That way you don't have to specify six zeros every time you want a solid circle.
__________________

Village Idiot is offline  
Reply With Quote
The Following User Says Thank You to Village Idiot For This Useful Post:
Killswitch (10-28-2009)