private void btnAnyCar_Click(object sender, EventArgs e) { Automobile myAuto = new Automobile(); Automobile myOtherAuto = new Car(); Automobile myOtherAutoT = new Truck(); Automobile myOtherAutoS = new SUV(); myAuto.Price = 100M; myAuto.Mileage = 10; myAuto.StartEngine(); myOtherAutoS.Make = "New SUV!"; myOtherAutoS.Mileage = 12; myOtherAutoS.Price = 22000M; myOtherAutoS.StartEngine(); myOtherAutoS.ShowInfo(); myOtherAuto.StartEngine(); myOtherAutoT.Price = 100000M; myOtherAutoT.Mileage = 10; myAuto.ShowInfo(); myOtherAutoT.ShowInfo(); //tryStartingAgain(myAuto); //tryStartingAgain(myOtherAuto); //Car coolCar = (Car) new Automobile(); //MessageBox.Show("Test: " + myOtherAuto.Doors); //Cannot access }
private void tryStartingAgain(Automobile auto) { auto.StartEngine(); }