posted 19 years ago
Dear Praveen,
Over-riding: This is done when you provide a different implementation of a method (belonging to a super-class) in your class. This over-riding method should have the same signature as your superclass method. And along with that the access modifier that you specify for the over-riding method should have a scope equal to OR higher than the superclass method.
Hope I am not confusing matters here.
As you can see from the example you provided, the method in your subclass had a scope smaller than the superclass, so the compiler throws an error.
Over-loading: This is done when the method signature is the same but either of the following conditions should be met:
the number of parameters is differentthe order of the parameters are differentthe type of parameters are different
I have a feeling I have written a lot of information that may be incorrect. So just wait until an expert comes in and verifies the information. I just wrote my understanding of Overloading/Over-riding methods.
[ April 20, 2006: Message edited by: Shyam Murarka ]
With Best Regards,
Shyam Prasad Murarka