There are two types of reference variable casting: downcasting and upcasting.
Downcasting: If you have a reference variable that refers to a subtype object,you can assign it to a reference variable of the subtype. You must make an explicit cast to do this, and the result is that you can access the subtype's members with this new reference variable.
Upcasting: You can assign a reference variable to a supertype reference variable explicitly or implicitly. This is an inherently safe operation because the assignment restricts the access capabilities of the new variable
Reference Variable Casting, Upcasting, DowncastingReference Variable Casting
Friday, August 21, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment