0

I know that there are milions of video tutorials on this and I have watched many of them. However, I still don't understand one thing about polymorphism and I was hoping that someone from here would be able to make it clear for me.

I have a class called Animal and a class called Dog which extends Animal. The Animal class has one method called makeNoise and Dog class overrides it. Now, what is the difference between declaring the Dog object this way:

Dog myDog = new Dog();

And:

Animal myDog = new Dog();

I know this is most likely a duplicate but I really want to understand this and was not able to do so from the resources that already exist.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
  • I know there's a duplicate, but this is the same idea https://stackoverflow.com/questions/8870173/what-are-the-list-or-arraylist-declaration-differences-in-java – OneCricketeer May 27 '17 at 16:04
  • Take a look at duplicate question (you may need to refresh this page to see it at top of your question). If that wasn't what you ware asking then please try to clarify your question. – Pshemo May 27 '17 at 16:06

0 Answers0