예제 #1
0
 static void Main(string[] args)
 {
     int extrinsicstate = 22;
     FlyWeightFactory f = new FlyWeightFactory();
     // Work with different flyweight instances
     FlyWeight fx = f.GetFlyWeight("X");
     fx.Operation(--extrinsicstate);
     FlyWeight fy = f.GetFlyWeight("Y");
     fy.Operation(--extrinsicstate);
     FlyWeight fz = f.GetFlyWeight("Z");
     fz.Operation(--extrinsicstate);
     UnsharedConcreateFlyWeight fu = new
     UnsharedConcreateFlyWeight();
     fu.Operation(--extrinsicstate);
     // Wait for user
     Console.Read();
 }
예제 #2
0
        static void Main(string[] args)
        {
            int extrinsicstate = 22;
            FlyWeightFactory f = new FlyWeightFactory();
            // Work with different flyweight instances
            FlyWeight fx = f.GetFlyWeight("X");

            fx.Operation(--extrinsicstate);
            FlyWeight fy = f.GetFlyWeight("Y");

            fy.Operation(--extrinsicstate);
            FlyWeight fz = f.GetFlyWeight("Z");

            fz.Operation(--extrinsicstate);
            UnsharedConcreateFlyWeight fu = new
                                            UnsharedConcreateFlyWeight();

            fu.Operation(--extrinsicstate);
            // Wait for user
            Console.Read();
        }