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
What is Upcasting and Downcasting.