Object-oriented programming

From Citizendium
Revision as of 00:44, 5 November 2008 by imported>Eric Evers (→‎Overloading)
Jump to navigation Jump to search

Overloading

When a child class uses more than one method with the same name,
one is overloading a function. Each function needs to have a 
different signature.
Class Diagram

+-------------------+
| Computer          |    class name
+-------------------+  
+-------------------+    
| sqrt( {A,B,i} )   |    methods  
| sqrt(  A  )       |    
+-------------------+

Definition of Signature
The signature of a function is the unique minimal description of a
function from the outside. Looking at a function from the outside
is sometimes called the interface of a function. The signature of 
a function is 
  * the name of the function
  * the number of arguments
Some languages include in the signature of a function the:
  * the type of the arguments
  * the return type is included in the signature