Hi Parth,
Regarding 1)
We can assign child class handle to parent class handle because, all the properties of a parent class are visible to a child class. This is needed to access the child class methods using parent class handle… this is what we say polymorphism.
We can not assign the parent class handle to a child class handle as there are properties which only exists in a child class, which are missing in a parent class.
Regarding 2)
You don’t need to use downcasting (assigning a parent class handle to base class using $cast) to access the methods of child class using parent class handle. Just use polymorphism here.
I have modified your code. Please find it in below link.
polymorphism - EDA Playground