since this is overloading of method so here method call will depend on the type of the reference.
the call render(c1, s1); essentially means a call to method which have parameter of type Circle and Shape. Also, if you try to change the signature of second method to then also the same method will be called but if you change this to then it will fail to compile as Shape is not of type Circle but opposite is true
What you have provided in your code is NOT overloading. The basic tenet for overloading requires at minimum, your Argument types are different. Simply swapping their order in the argument list, does not constitute this.
Hope this helps
Steve Davies
be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Stephen Davies wrote:What you have provided in your code is NOT overloading.
If what you are saying is true, then that means that the methods are the same. Then can you tell us how the code get's compiled if there are two methods with same signature in a class...