static void Main(string[] args) { Car car1 = new Car(); car1.Colour="Black"; car1.Make="Mercedes-Benz"; car1.Type="C220"; car1.Country="Germany"; car1.Cost=31000; car1.EngineSize=2.1; Console.WriteLine( "Car is a " + car1.Cost + " " + car1.Colour + " " + car1.EngineSize + " " + car1.Make + " " + car1.Type + " from " + car1.Country); Console.ReadLine(); }
static void Main(string[] args) { Car[] koli = new Car[5]; for (int i = 0; i < koli.Length; i++) { koli[i] = new Car(345); } foreach (var item in koli) { Console.WriteLine(item); } }
static void Main(string[] args) { Car myCar = new Car(); //initializing new Car myCar.Make = "Chevy"; myCar.Model = "Cruze - LT1"; myCar.Year = 2014; myCar.Color = "Siver"; printVehicleDetails(myCar); Truck myTruck = new Truck(); //initializing new Truck myTruck.Make = "Ford"; myTruck.Model = "F950"; myTruck.Year = 2006; myTruck.Color = "Black"; myTruck.TowingCapacity = 1200; printVehicleDetails(myTruck); Console.ReadLine(); }