Information Technology Reference
In-Depth Information
Fig. 2.3
Class hierarchy
2.4.1 Overloading
Overloading is an object-oriented programming practice by which, in certain
circumstances, different methods of a class can share the same name. This is
known as overloading the name with multiple implementations (Jia 2003 ). One of
two criteria must be met in order for two methods to overload the same name:
1. The methods must accept a different number of arguments.
2. The arguments accepted by the methods must be of different data types.
Due to the potential for overloading, programming languages do not use only
the name of a method, but rather the signature, which consists of the name in
combination with the arguments passed, in order to determine which implemen-
tation of a method to call. The following class description provides an example of
overloading.
 
Search WWH ::




Custom Search