by, 04-26-2012 at 06:36 PM (422 Views)
In a subclass, an instance method with same sign (name, number & parameter type) & return type, as instance method overrides method of superclass.
Subclass has an ability to override method which permits class for inheritance, from superclass. Superclass has a behavior which is considered to be close enough and then behavior is modified as per requirement. Overriding method consist of similar parameter types, return type, number and name, as method that it overrides. Type’s subtype is returned by the overriding method, which gets returned via overridden method. This is known as covariant return type.