public RedHeadDuck()
 {
     quackBehavior = new Quack();
     flyBehavior   = new FlyWithWings();
 }
Пример #2
0
 public MallardDuck() {
     _quackBehavior = new Quack();
     _flyBehavior = new FlyWithWings();
 }
Пример #3
0
 public MallardDuck()
 {
     _quackBehavior = new Quack();
     _flyBehavior   = new FlyWithWings();
 }
Пример #4
0
 public ModelDuck()
 {
     _flyBehavior   = new FlyNoWay();
     _quackBehavior = new Quack();
 }
Пример #5
0
 public MallardDuck()
 {
     FlyBehaviour   = new FlyWithWings();
     QuackBehaviour = new Quack();
 }
Пример #6
0
 /// <summary>
 /// 写一个构造函数,可以保证创建对象时,将实例复制给父类的quackBehavior
 /// </summary>
 public MallardDuck()
 {
     quackBehavior = new Quack();        //绿头鸭使用Quack类处理呱呱叫,所以当performQuack()被调用时,叫的职责被委托给Quack对象,而我们得到了真正的呱呱叫。
     flyBehavior   = new FlyWithWings(); //使用FlyWithWings作为其FlyBehavior类型。
 }
Пример #7
0
 public ModelDuck()
 {
     FlyBehavior   = new FlyNoWay();
     QuackBehavior = new Quack();
 }
Пример #8
0
 public ModeDuck()
 {
     flyBehavior   = new FlyNoWay();
     quackBehavior = new Quack();
 }
Пример #9
0
 public GreenHeadDuck()
 {
     flyBehavior   = new FlyWithWings();
     quackBehavior = new Quack();
 }
Пример #10
0
 public MallardDuck()
 {
     quackBehavior = new Quack();
     flyBehavior   = new Fly();
 }
Пример #11
0
 public override void AssignQuackBehavior()
 {
     quackBehavior = new Quack();
 }
Пример #12
0
 public RedheadDuck()
 {
     flyBehavior   = new FlyWithWings();
     quackBehavior = new Quack();
 }