private static void DecoratorPatternDemo()
        {
            IBicycle myTourBike = new Touring(new NarrowWheel(24));

            Console.WriteLine(myTourBike);

            myTourBike = new CustomGripOption(myTourBike);

            Console.WriteLine(myTourBike);

            myTourBike = new LeatherSeatOption(myTourBike);

            Console.WriteLine(myTourBike);
        }
Exemple #2
0
        private static void DecoratorPatternDemo()
        {
            //Standard Touring Bike
            IBicycle myTourbike = new Touring(new NarrowWheel(24));

            Console.WriteLine(myTourbike);

            // Touring bike with custom grips
            myTourbike = new CustomGripOption(myTourbike);
            Console.WriteLine(myTourbike);

            // Touring bike with leather seat
            myTourbike = new LeatherSeatOption(myTourbike);
            Console.WriteLine(myTourbike);
        }
        //Decorator Design Pattern Method
        private static void DecoratorPatternDemo()
        {
            //Standard Touring Bike taht displays their result to the console
            IBicycle myTourbike = new Touring(new NarrowWheel(24));

            Console.WriteLine(myTourbike);

            //Touring bike with custom grips added to the total price and their result is printed to the console
            myTourbike = new CustomGripOption(myTourbike);
            Console.WriteLine(myTourbike);

            //Touring bike with leather seat added to the existing total and their result is printed to the console
            myTourbike = new LeatherSeatOption(myTourbike);
            Console.WriteLine(myTourbike);
        }
        /* Decorator Design Pattern Method */
        private static void DecoratorPatternDemo()
        {
            //Standard Touring Bike
            IBicycle myTourBike = new Touring(BikeColor.Gold, new NarrowWheel(24));

            Console.WriteLine(myTourBike);

            myTourBike = new CustomGripOption(myTourBike);
            Console.WriteLine(myTourBike);

            myTourBike = new LeatherSeatOption(myTourBike);
            Console.WriteLine(myTourBike);

            myTourBike = new GoldFrameOption(myTourBike);
            Console.WriteLine(myTourBike);
        }