+ 1
Explain down casting.
4 Réponses
+ 3
lol ..when youre sad???
+ 1
It's not lol
I am seriously asking
+ 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
+ 1
thanks a lot bro