1. Question: Which is the correct way to upcasting steps as the following code fragment?
    public class Asset{
      public string Name;
    
    }
    
    public class Stock : Asset{
      public long SharesOwned;
    }
    
    public class House : Asset{
      public decimal Mortgage;
    
    }

    A
    Stock s=new Stock(); Asset a=s;

    B
    Asset a=new Asset(); Stock s=a;

    C
    Stock s=new Stock(); Asset a=s; Stock s=(Stock)a;

    D
    House h=new Stock(); Asset a=h;

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd