/* This Driver just illustrates casting up and down an inheritance hierarchy. */ public class SimpleDriver { public static void main(String [] args) { StarShip regular = new StarShip(); KlingStarShip kling = new KlingStarShip(); // regular.utterBattleCry(); regular = kling; //regular.utterBattleCry(); // I point to a Kling but I think I refer to a regular ((KlingStarShip) regular).utterBattleCry(); // I point to a Kling but I think I refer to a regular regular = new StarShip(); kling = (KlingStarShip) regular; kling.utterBattleCry(); // Inappropriate action for type } }