Is it possible to call subclasses’ methods on a superclass object?

This won’t compile since Animal does not have a method called bark. Think of it this way, all dogs are animals, but not all animals are dogs. All dogs bark, but not all animals bark.

Leave a Comment