コード例 #1
0
        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);
        }
コード例 #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);
        }
コード例 #3
0
        private static void DecoratorPatternDemo()
        {
            //standard touring bike
            IBicycle myTourBike = new Touring(new Narrowheel(24));

            Console.WriteLine(myTourBike);

            //Touring bike withcustom grip
            myTourBike = new CustomGripOption(myTourBike);
            Console.WriteLine(myTourBike);

            //touring bike with Leatherseat
            myTourBike = new LeatherSheetOption(myTourBike);
            Console.WriteLine(myTourBike);
        }
コード例 #4
0
        //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);
        }
コード例 #5
0
        /* 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);
        }
コード例 #6
0
        private static void DecoratorPatternDemo()
        {
            //standrad touring bike
            IBicycle myTourbike = new Touring(new NarrowWheel(24));

            Console.WriteLine(myTourbike);

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

            //tour bike with leather seat
            myTourbike = new LeatherSheetOption(myTourbike);
            Console.WriteLine(myTourbike);
            //tour bike with whitetire

            myTourbike = new WhiteTireOption(myTourbike);
            Console.WriteLine(myTourbike);
        }