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 }
static void Main(string[] args) { Automobile car = new Automobile("Packard", "Custom Eight", 1948); Console.WriteLine(car); PlayWithBooks(); PlayWithShapes(); }
static void Main(string[] args) { Boat ssSonja = new Boat(2, 500, "red", 80.0d, .90d); ssSonja.Move(); ssSonja.Move(); Console.WriteLine("Boat " + ssSonja.GetDistanceTraveled()); Automobile tesla = new Automobile(4, 22, 2, 2, 500, "Yellow", 250d); tesla.Move(); Console.WriteLine("car " + tesla.GetDistanceTraveled()); }
private void tryStartingAgain(Automobile auto) { auto.StartEngine(); }
public void Run() { var packard = new Automobile("Packard", "Custom Eight", 1948); Console.WriteLine(packard); }