+ 2

DownCasting in Class

Can Someone explain me? I am getting confused with it. also, explain me the scenarios where we can use downcasting.

14th Jan 2017, 4:37 PM
Ashish Kumar Singh
Ashish Kumar Singh - avatar
2 Answers
+ 1
I am having similar issue understanding downcast
15th Jan 2017, 12:46 AM
Hans Kalders
Hans Kalders - avatar
+ 1
i can explain this . when u cast a decimal number to integer it store in int variable type and the decimal point of previously preseneted vanishes and it is treated as integer. similarly in down casting when a object is created of subclass using casting of superclass then the object is treated as a type superclass not the subclass
21st Jan 2017, 1:52 PM
SIBA PRASAD SAHU
SIBA PRASAD SAHU - avatar