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(); }