static void Main(string[] args) { //Tyres Tyre nokia = new Tyre { Name = "Nokia", Model = "Hakkapeliitta", Size = "205R16" }; Tyre micb = new Tyre { Name = "Mic", Model = "Pilot", Size = "160R17" }; Tyre mics = new Tyre { Name = "Mic", Model = "Pilot", Size = "140R16" }; //Vehicles Vehicle porsche = new Vehicle(); porsche.Name = "Porsche"; porsche.Model = "911"; porsche.AddTyre(nokia); porsche.AddTyre(nokia); porsche.AddTyre(nokia); porsche.AddTyre(nokia); Vehicle ducati = new Vehicle(); ducati.Name = "Ducati"; ducati.Model = "Diavel"; ducati.AddTyre(micb); ducati.AddTyre(mics); //Print stuff Console.WriteLine(porsche.ToString()); Console.WriteLine(ducati.ToString()); Console.ReadLine(); }
static void Main(string[] args) { Tyres tyre1 = new Tyres { Name = "nokia", Model = "Hakkapeliitta", Size = "21" }; Tyres tyre2 = new Tyres { Name = "nokia", Model = "Hakkapeliitta", Size = "18" }; /*tyre.Name = "nokia"; tyre.Model = "Hakkapeliitta"; tyre.Size = "21";*/ Vehicle vehicle = new Vehicle { Name = "Ferrari", Model = "458" } ; /* vehicle.Name = "Ferrari"; vehicle.Model = "458";*/ vehicle.AddTyre(tyre1); //car contains tyres.. vehicle.AddTyre(tyre1); vehicle.AddTyre(tyre2); vehicle.AddTyre(tyre2); Console.WriteLine(vehicle.ToString()); Console.ReadLine(); }
static void Main(string[] args) { // create tyre Tyre tyre = new Tyre { Name = "Nokia", Model = "Hakkapeliitta", Size = "205R16" }; Vehicle car = new Vehicle { Name = "Porsche", Model = "911" }; car.AddTyre(tyre); // car contains tyres... D: car.AddTyre(tyre); // car contains tyres... D: car.AddTyre(tyre); // car contains tyres... D: car.AddTyre(tyre); // car contains tyres... D: Console.WriteLine(car.ToString()); Console.ReadLine(); }
static void Main(string[] args) { Tyre tyre = new Tyre { Name = "Nokia", Model = "Hakkapeliitta", TyreSize = "205R16" }; Vehicle car = new Vehicle { Name = "Datsun", Model = "100A" }; car.AddTyre(tyre); car.AddTyre(tyre); car.AddTyre(tyre); car.AddTyre(tyre); Console.WriteLine(car.ToString()); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); }
static void Main(string[] args) { // create tyre Tyre tyre = new Tyre { Name = "Nokia", Model = "Hakka", TyreSize = "205R16" }; // create car Vehicle car = new Vehicle(); car.Name = "Audi"; car.Model = "R8"; car.AddTyre(tyre); car.AddTyre(tyre); car.AddTyre(tyre); car.AddTyre(tyre); Console.WriteLine(car.ToString()); Console.WriteLine("Press enter to continue..."); Console.ReadLine(); }