static void Main(string[] args)
        {
            Bike bike1 = new Bike();
            //bike1.Display();
            Bike.PetrolTanks = 2;
            bike1.EngineCapacity = "250cc";
            bike1.Model = "2014";
            //DisplayBikeINfo(bike1);
            bike1.Display("AB");
            //bike1.Display();
            Bike bike2 = new Bike("2014", "350cc");
            //DisplayBikeINfo(bike2);
            //bike2.Display();
            //bike2.Display("DLF");
            ParkingStation p = new ParkingStation(2);
            p.Park(bike1);
            p.Park(bike2);
            p.UnPark(0);
            Bike bike3 = new Bike();
            p.Park(bike3);
            p.Park(bike2);

            ParkingStation dynamicParkingStation = new ParkingStation();
            dynamicParkingStation.Park(bike1,true);
            dynamicParkingStation.Park(bike2,true);
            dynamicParkingStation.Park(bike3,true);
        }
Ejemplo n.º 2
0
        public static void Run()
        {
            Console.WriteLine($"{Environment.NewLine}*** STATE PATTERN ***{Environment.NewLine}");

            Bike bike = new Bike("Rob");

            // Road Bike
            bike.Display();

            // Hybrid Bike
            bike.Add(ComponentType.Shocks);
            bike.Display();

            // Mountain Bike
            bike.Add(ComponentType.DiscBrakes);
            bike.Display();

            // Road Bike
            bike.Remove(ComponentType.DiscBrakes);
            bike.Remove(ComponentType.Shocks);
            bike.Display();
        }
Ejemplo n.º 3
0
 // Add the methods here you want the decorator to handle
 public override void Display()
 {
     _bike.Display();
 }