public static void Main() { Maruti car1 = new Maruti("Swift", 2015); Mahindra car2 = new Mahindra("Swift", 2015); Console.WriteLine("Car1 Details:"); Console.WriteLine("Name: {0} and Manufecturing Year: {1}", car1.Name, car1.MfgYear); }
public static void Main() { Maruti mu = new Maruti("maruti", 10, 2.1); Mahindra ma = new Mahindra("mahindra", 20, 3.1); mu.Display(); ma.Display(); }
public static void Main() { Maruti car1 = new Maruti("Swift"); car1.haveAGS = true; car1.Name = "Swift"; Console.WriteLine("Details Car 1: {0} and {1}", car1.Name, car1.haveAGS == true?"Have AGS":"not Have AGS"); Mahindra car2 = new Mahindra(); car2.Name = "XUV500"; Console.WriteLine("Car 2: {0}", car2.Name); }
static void Main(string[] args) { CarFactory manufacture = new TataMotors(); var car = manufacture.DeliverCar("seden"); Console.WriteLine("Introducing {0}", car.ModelName); Console.WriteLine(car); car = manufacture.DeliverCar("luv"); Console.WriteLine("Introducing {0}", car.ModelName); Console.WriteLine(car); manufacture = new Mahindra(); car = manufacture.DeliverCar("suv"); Console.WriteLine("Introducing {0}", car.ModelName); Console.WriteLine(car); Console.Read(); }