1. 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;

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd