In one of my prof slides on ploymorphism, I see this piece of code with a couple of comments:
discountVariable =              //will produce
  (DiscountSale)saleVariable;//run-time error
discountVariable = saleVariable //will produce
                                //compiler error
As you can see, it says in the first casting statement that it'll produce run-time error and in the other one it says it'll produce compiler error.
What makes these errors? and how they differ from each other?
 
     
     
     
     
     
     
     
     
     
     
     
    