public void AddEngine(ICar1 car) { if (car is BMWCar) { BMWCar BMWCar = (BMWCar)car; BMWCar.Engine = "Petrol Engine"; Console.WriteLine("PetrolCarDecorator added Petrol Engine to the Car : " + car); } }
public static void Start() { Console.WriteLine("Hello World!"); ICar1 bmwCar1 = new BMWCar(); bmwCar1.ManufactureCar(); Console.WriteLine(bmwCar1 + "\n"); ICar1 bmwCar2 = new BMWCar(); PetrolCarDecorator carWithPetrolEngine = new PetrolCarDecorator(bmwCar2); carWithPetrolEngine.ManufactureCar(); Console.ReadLine(); }