+ 1

Explain down casting.

20th Jan 2018, 11:37 AM
Jitendra Singh
Jitendra Singh - avatar
4 ответов
+ 3
lol ..when youre sad???
20th Jan 2018, 12:47 PM
Android Boi
Android Boi - avatar
+ 1
It's not lol I am seriously asking
20th Jan 2018, 12:52 PM
Jitendra Singh
Jitendra Singh - avatar
+ 1
Down casting objects is where you cast something to the type of a child class. An example from Android: TextView t = (TextView) getViewById(id); The method returns a View, but here we specifically want a TextView, which is a class that extends View. Without the cast this will not compile because a View is not necessarily a TextView, but we can downcast the type to indicate that we are expecting a TextView from this call
20th Jan 2018, 2:28 PM
Dan Walker
Dan Walker - avatar
+ 1
thanks a lot bro
20th Jan 2018, 2:35 PM
Jitendra Singh
Jitendra Singh - avatar