static void Main(string[] args) { Car toyota = new Toyota(); toyota.Accelerate(); toyota.Run(); Car ferrari = new Ferrari(); ferrari.Accelerate(); ferrari.Run(); ferrari.Stop(); // this stops the car not the car, because the Stop in Ferrari is a `new` Ferrari realFerrari = (Ferrari)ferrari; realFerrari.Stop(); // this stops the Ferrari }
static void Main(string[] args) { Car toyota = new Toyota(); toyota.Accelerate(); toyota.Run(); Car ferrari = new Ferrari(); ferrari.Accelerate(); ferrari.Run(); ferrari.Stop(); Ferrari realFerrari = (Ferrari)ferrari; realFerrari.Stop(); }