p = d1;
Legal and compile and runtime. This is because
automatic conversions are legal going up the hierarchy. What helps me to remember how this works is to think that since d1 is an object whose class is a subclass of Parent, d1 has all information needed to create an instance of Parent.
Where as if you go down the hierarchy, Parent does not have information to create in instance of
DerivedOne, so you need an explicit cast.