private static void TestCars() { Car car = new Audi(); Console.WriteLine("Is Audi eco friendly : {0}", car.IsEcoFriendly(false)); car = new Volkswagen(); Console.WriteLine(); Console.WriteLine("Is Volkswagen eco friendly : {0}", car.IsEcoFriendly(false)); Console.WriteLine("Volkswagen mileage: {0}", ((Volkswagen) car).GetMileage()); }
static void Main(string[] args) { Audi a = new Audi(); Console.WriteLine(a.IsEcoFriendly(false)); a.MoveNKilometers(23); Console.WriteLine(a.Mileage); BMW b = new BMW(); Console.WriteLine(b.IsEcoFriendly(false)); b.MoveNKilometers(45); Console.WriteLine(b.Mileage); Volkswagen v = new Volkswagen(); Console.WriteLine(v.IsEcoFriendly(false)); v.MoveNKilometers(88); Console.WriteLine(v.Mileage); Honda h = new Honda(); Console.WriteLine(h.IsEcoFriendly(false)); Skoda s = new Skoda(); Console.WriteLine(s.IsEcoFriendly(false)); Console.ReadKey(); }
static void Main(string[] args) { Audi a7 = new Audi(); a7.Move(30000); Console.WriteLine("Audi a7 has passed {0} miles", a7.Mileage); Console.WriteLine("Audi a7 is eco friendly: {0}", a7.IsEcoFriendly(false)); BMW m5 = new BMW(); m5.Move(90000); Console.WriteLine("Bmw m5 has passed {0} miles", m5.Mileage); Console.WriteLine("Bmw m5 is eco friendly: {0}", m5.IsEcoFriendly(false)); Volkswagen golf = new Volkswagen(); golf.Move(135000); Console.WriteLine("Volkswagen golf has passed {0} miles", golf.Mileage); Console.WriteLine("Volkswagen golf is eco friendly: {0}", golf.IsEcoFriendly(false)); Honda civic = new Honda(); Console.WriteLine("Honda civic is eco friendly: {0}", civic.IsEcoFriendly(false)); Skoda fabia = new Skoda(); Console.WriteLine("Skoda fabia is eco friendly: {0}", fabia.IsEcoFriendly(false)); }