コード例 #1
0
        static void Main()
        {
            Duck Mallard = new MallardDuck();
            Mallard.Kill += new EventHandler(Mallard_Kill);
            
            ShowDuck(Mallard, false,null,null);
            Console.WriteLine();

            Console.WriteLine(Resources.StrRTCB);
            
            ShowDuck(Mallard,true,new FlyRocketPowered(),new Squeak());
            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.PerformQuack();
            mallard.PerformFly();
            Console.ReadLine();

            Duck model = new ModelDuck();

            model.PerformFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.PerformFly();
            Console.ReadLine();
        }