示例#1
0
        static void Main(string[] args)
        {
            var view        = new ConsoleView();
            var mallardDuck = new MallardDuck();
            var rubberDuck  = new RubberDuck();
            var modelDuck   = new ModelDuck();

            view.Info(mallardDuck);
            view.Info(rubberDuck);
            view.Info(modelDuck);
            modelDuck.Flyable = new FlyRocketPowered();
            view.Info(modelDuck);
        }
示例#2
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();
        }