posted 11 years ago
SuperClass can not be casted to subclass, because subclass contains more features then superclass, and when you try this, subclass needs all the details to become a complete object while superclass provides only the basic details , so as a result it is not allowed.
e.g
Every Car has engine , but not all the cars have cruise-tonic system, so when you try to convert a superCar into subCar, subCar will require cruise-tonic system , while it will no t be provided, so as a result subCar can not be completed,
So that's why in programming languages it is not allowed to avoid post casting problems of objects.
:-)
Regards,
Safdar Khan