Exemple #1
0
 public MallardDuck()
 {
     QuackBehavior = new NormalQuack();
     FlyBehavior   = new FlyWithWings();
 }
 public RedheadDuck()
 {
     FlyBehavior = new FlyWithWings();
     QuackBehavior = new NormalQuack();
 }
Exemple #3
0
 public ModelDuck()
 {
     _flyBehavior   = new FlyNoWay();
     _quackBehavior = new NormalQuack();
 }
Exemple #4
0
 //这里还是显式的实现了具体对象
 protected MallardDuck()
 {
     QuackBehavior = new NormalQuack();
     FlyBehavior   = new FlyWithWings();
 }
Exemple #5
0
 public ModelDuck()
 {
     FlyBehaviour   = new NoCanFly();
     QuackBehaviour = new NormalQuack();
 }
 public RubberDuck()
 {
     QuackBehavior = new NormalQuack();
     FlyBehavior   = new FlyNoWay();
 }
 public NormalDuck()
 {
     _fly   = new SlowFly();     //缓慢飞行
     _quack = new NormalQuack(); //正常叫声
 }
Exemple #8
0
 public RedHeadDuck()
 {
     flyBehavior   = new FlyWithWings();
     quackBehavior = new NormalQuack();
 }
 public MallardDuck() : base()
 {
     _flyBehavior   = new FlyWithWings();
     _quackBehavior = new NormalQuack();
 }
 public MallardDuck(string Name)
 {
     this.Name     = Name;
     flyBehavior   = new FlyWithWings();
     quackBehavior = new NormalQuack();
 }