コード例 #1
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.PerformQuack();
            mallard.PerformFly();

            Duck model = new ModelDuck();

            model.PerformFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.PerformFly();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Duck duck = new MallardDuck();

            duck.Display();
            duck.PerformFly();
            duck.PerformQuack();

            duck = new RubberDuck();
            duck.Display();
            duck.PerformFly();
            duck.PerformQuack();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: andrebiasi/training
        static void Main(string[] args)
        {
            Duck mallardDuck = new MallardDuck();

            mallardDuck.Display();
            mallardDuck.Swim();
            mallardDuck.PerformMakeSound();
            mallardDuck.PerformFly();

            Console.WriteLine("----------------------------");

            Duck rubberDuck = new RubberDuck();

            rubberDuck.Display();
            rubberDuck.Swim();
            rubberDuck.PerformMakeSound();
            rubberDuck.PerformFly();

            Console.ReadLine();
        }