// When the forms loads, I initialise the objects public void Car_Load(object sender, EventArgs e) { M1 = new Melcedes(Melcedes.Text, MelcedesPicture); B1 = new BMW(BMW.Text, BMWPicture); L1 = new Lexus(Lexus.Text, LexusPicture); T1 = new Toyota(Toyota.Text, ToyotaPicture); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var cars = new List <Car> { new Audi(200, "blue", "A4"), new BMW(250, "red", "M3") }; foreach (var car in cars) { car.Repair(); } Car bmwz4 = new BMW(200, "black", "Z3"); Car audiA3 = new Audi(100, "green", "A3"); bmwz4.ShowDetails(); audiA3.ShowDetails(); BMW bmwz5 = new BMW(330, "white", "Z999"); bmwz5.ShowDetails(); bmwz4.SetCarIdIndo(53656, "Alfred"); bmwz4.GetCarIdInfo(); Car car8 = (Car)bmwz5; car8.ShowDetails(); //M3 mym3 = new M3(250, "red", "M3 super turbo"); //mym3.Repair(); Console.ReadLine(); }