Upcasting in OOPS makes runtime polymorphism possible by overriding methods of parent and child classes. Can downcasting in OOPS also be run-time polymorphic in any way?
Asked
Active
Viewed 153 times
1 Answers
0
runtime polymorphism is made possible by inheritance -- upcasting and downcasting are irrelevant to it (though they are also only possible with inheritance).
Downcasting generally requires runtime polymorphism, as the downcast may succeed or fail based on the runtime type.

Chris Dodd
- 119,907
- 13
- 134
- 226
-
"Downcasting generally requires runtime polymorphism, as the downcast may succeed or fail based on the runtime time". Can you elaborate this statement? – Kamalapriya Subramanian Sep 09 '18 at 01:03
-
@user16406 - "Downcasting generally requires runtime polymorphism, as the downcast may succeed or fail based on the runtime time". Can you elaborate this statement? – Kamalapriya Subramanian Sep 10 '18 at 16:12
-
@KamalapriyaSubramanian: typo "time"->"type". Since the success or failure depends on the runtime type, you need some way of identifying the runtime type at runtime -- that is runtime polymorphism. – Chris Dodd Sep 10 '18 at 18:37
-
@user16406 - Thank you – Kamalapriya Subramanian Sep 10 '18 at 18:43