Content deleted Content added
Line 8:
==Overriding and overloading==
[[Method overriding]] and [[overloading]] are two of the most significant ways that a method differs from a conventional procedure or function call. Overriding refers to a subclass redefining the implementation of a method of its superclass. For example, <code>findArea</code> may be a method defined on a shape class. The various subclasses: <code>rectangle</code>, <code>circle</code>, <code>triangle</code>, etc. would each define the appropriate formula to calculate their area. The idea is to look at objects as "black boxes" so that changes to the internals of the object can be made with minimal impact on the other objects that use it. This is known as encapsulation and is meant to make code easier to maintain and re-use.
[[Method overloading]], on the other hand, refers to differentiating the code used to handle a message based on the parameters of the method. If one views the receiving object as the first parameter in any method then overriding is just a special case of overloading where the selection is based only on the first argument.<ref>[http://www.codeproject.com/Articles/16407/METHOD-Overload-Vs-Overriding http://www.codeproject.com/Articles/16407/METHOD-Overload-Vs-Overriding]</ref> The following simple [[Java language|Java]] example illustrates the difference:<ref>{{cite web
| accessdate = 2011-08-12
| author = John Suzuki
|