Object-oriented programming: Difference between revisions
Jump to navigation
Jump to search
imported>Eric Evers |
imported>Eric Evers |
||
Line 1: | Line 1: | ||
==Overloading== | ==Overloading== | ||
When a child class uses more than one method with the same name, | When a child class uses more than one method with the same name, |
Revision as of 00:44, 5 November 2008
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