Question OOP-POLY-0058
MediumAnimal a = new Dog(); compiles in Java, but Dog d = new Animal(); does not. Why?
- A.
Dog has more fields
- B.
Every Dog is an Animal (safe upcast), but an Animal is not necessarily a Dog
- C.
Constructors are not inherited
- D.
Animal is abstract
Sign up free to see the answer and a step-by-step explanation.