Candibiotic
News Update :

Reference Variable Casting, Upcasting, DowncastingReference Variable Casting

Friday, August 21, 2009

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
Share this Article on :

0 comments:

Post a Comment

 

© Copyright Vinayak Wins 2010 -2011 | Design by Herdiansyah Hamzah | Published by Borneo Templates | Powered by Blogger.com.