예제 #1
0
        private static void TouringBike()
        {
            AbstractRoadBike roadBike = new Touring(BikeColor.Gold, new NarrowWheel(12));
            BikeBuilder      builder  = new RoadBikeBuilder(roadBike);
            BikeDirector     director = new RoadBikeDirector();
            IBicycle         bicycle  = director.Build(builder);

            Console.WriteLine(bicycle);
        }
예제 #2
0
        static void DecoratorDemo()
        {
            IBicycle tourBike = new Touring(new NarrowWheel(23));

            Console.WriteLine(tourBike);

            tourBike = new GoldFrame(tourBike);
            Console.WriteLine(tourBike);

            tourBike = new CustomGrip(tourBike);
            Console.WriteLine(tourBike);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
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);
        }