differences among the objects | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

differences among the objects

what's the difference among Animal a=new Animal(); Animal a=new Dog(); and Dog a=new Dog(); (the Animal is the superclass and the Dog is subclass and a is the object)

5th May 2020, 4:57 AM
Zhengrong Yan
Zhengrong Yan - avatar
1 Answer
+ 1
1)Animal is the Parent Class. 2)Dog is the Child Parent. Parent class object can refers to child class object.
5th May 2020, 8:24 AM
Dasarath Singh