Code that demonstrates the effect of casting on instance variable retrieval directly and indirectly and when polymorphism applies.