I am trying to understand Java\'s polymorphism, and I have one question about downcasting an object.
Let\'s say for this example I have two subclasses Dog and Cat that inher
Here you are talking about downcasting, so in this scenario always superclass should be used as a reference and child object should be pointed by that.
This usd basically in factory patter.