Question:What is Upcasting and Downcasting. 

Answer Upcasting: An upcast operation creates a base class reference from a subclass reference. Example:
Stock msft = new Stock();
       Asset a = msft;
Downcasting: A downcast operation creates a subclass reference from a base class reference. Example:
Stock msft = new Stock();
       Asset a = msft;
       Stock s = (Stock)a;
 

+ Report
Total Preview: 1113
What is Upcasting and Downcasting.
Copyright © 2024. Powered by Intellect Software Ltd