static void Main(string[] args) { Bil b = new Bil(); b.BilId = 1; b.Model = "Toyota"; b.AntalCylindre = 4; Lastbil l = new Lastbil() { BilId = 2, Model = "", AntalCylindre = 7 }; b.Print(); l.Print(); Personbil p = new Personbil() { Model = "Fantastiske Toyota" }; p.Print(); Bil[] biler = new Bil[4]; biler[0] = b; biler[1] = l; biler[2] = p; biler[3] = new Bil(7); foreach (var bil in biler) { bil.Print(); } }
static void Main(string[] args) { Bil b = new Bil(); b.BilId = 1; b.Model = "Ford"; b.AntalCylindre = 4; LastBil l = new LastBil() { BilId = 2, Model = "Rookie", AntalCylindre = 8 }; l.Print(); b.Print(); Console.ReadLine(); PersonBil p = new PersonBil() { Model = "Z" }; p.Print(); Bil[] biler = new Bil[3]; biler[0] = b; biler[1] = l; biler[2] = p; foreach (var bil in biler) { bil.Print(); } Console.ReadLine(); }
static void Main(string[] args) { Bil b = new Bil(); b.BilId = 1; b.Model = "X"; b.AntalCylindre = 4; Console.WriteLine("Ny bil"); Console.ReadKey(); LastBil a = new LastBil(); a.BilId = 2; a.Model = "Y"; a.AntalCylindre = 8; b.Print(); a.Print(); Console.ReadKey(); }