My opinion, as a rule, will not.
The reason is that even if you could somehow make your FlyingCar behave as if it were a car from this point forward, it was still working on as if it were a FlyingCar, and maybe more not be in the correct condition for the car.
Perhaps the reason your graphics engine cannot display the FlyingCar is due to the textures it uses. But someone already called the load_appropriate_textures method on it, which saved their texture data in it. Changing the FlyingCar to the car will change what happened if you load_appropriate_textures again, but FlyingCar does not override the render_car method, it just puts the data where render_car finds it. Therefore, some other bad programmers in your organization just end up trying to debug why the car cannot display with some FlyingCar error message.
Perhaps this will not happen in this particular case. But it could be. And someone can modify Car and FlyingCar later in a way to introduce such a problem.
In general, for FlyingCar “as if” it was a car, you really need to repeat all initialization (and subsequent modifications) again. Repetition of later changes is usually impossible (because they are not recorded), and repetition of initialization means nothing more than the creation of a new car.
So it seems that “in general” is a bad idea. In any case, if you can find a way to do this, you may decide that this is acceptable. Programmers make compromises every day, this happens. But if this cannot be done with complete generality, then you always risk that quite reasonable changes will be made in Car and / or FlyingCar later that will make your hacks more inoperative.
Indeed, it seems that FlyingCar needs functionality to disable its flight functionality. Something like this is always very difficult to fix after the fact.
source share