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) { Vehicle vechicle = new Vehicle {Model = "Auto", Name = "Lada" }; Tyre tyre = new Tyre { Name = "Nokia", Model = "Hakkapeliitta", Size = "Iso" }; vechicle.AddTyres(tyre); vechicle.AddTyres(tyre); vechicle.AddTyres(tyre); vechicle.AddTyres(tyre); Console.WriteLine(vechicle.ToString()); }
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(); }
public void AddTyre(Tyre tyre) { Tyres.Add(tyre); }