Overloading

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by Ebybymic (Talk); changed back to last version by BenMcDonald)
 
Line 7: Line 7:
 
[[Image:overloading.JPG]]
 
[[Image:overloading.JPG]]
  
>==The problem with overloading==
+
==The problem with overloading==
 
Method overloading can create hard to read code as method arguments are hidden to the reader. It is not clear from reading code that method arguments are being overloaded and discovering overloaded methods requires searching though an object's definition.
 
Method overloading can create hard to read code as method arguments are hidden to the reader. It is not clear from reading code that method arguments are being overloaded and discovering overloaded methods requires searching though an object's definition.
  
Line 15: Line 15:
  
 
[[Category: Nomenclature]]
 
[[Category: Nomenclature]]
 
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://yzolynali.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]=
 
----
 
=[http://yzolynali.co.cc CLICK HERE]=
 
----
 
</div>
 

Latest revision as of 03:23, 25 November 2010

Overloading occurs when several methods have the same names with different method signatures. In the example above, the same method speak can have 2 different forms or method signatures. The first one only includes a single parameter word, the second one includes 2 parameters: word and language.

Overloading lets two functions/method share a name if they differ in the number and or the type of arguments; two functions may not differ only in their return type

Overloading.JPG

The problem with overloading

Method overloading can create hard to read code as method arguments are hidden to the reader. It is not clear from reading code that method arguments are being overloaded and discovering overloaded methods requires searching though an object's definition.

Consider Option-operand separation instead.


Personal tools