why to write as animal dog=new animal(); while creating object of class dog instead of animal dog as in c++; | Sololearn: Learn to code for FREE!

0

why to write as animal dog=new animal(); while creating object of class dog instead of animal dog as in c++;

11/1/2016 7:30:46 PM

Ankush Sayyer

1 Answer

New Answer

0

dog extends animal, you can do it : Dog dog = new Dog(); or Dog dog = new Animal(); for instance.