public Duck(string name, IFlyBehavior flyBehavior, IQuackBehavior quackBehavior, IWalkBehavior walkBehavior)
 {
     Name            = name ?? throw new ArgumentNullException(nameof(name));
     m_FlyBehavior   = flyBehavior ?? throw new ArgumentNullException(nameof(flyBehavior));
     m_QuackBehavior = quackBehavior ?? throw new ArgumentNullException(nameof(quackBehavior));
     m_WalkBehavior  = walkBehavior ?? throw new ArgumentNullException(nameof(walkBehavior));
 }
 public MallardDuck(
     IFlyBehavior flyBehavior,
     IQuackBehavior quackBehavior)
 {
     FlyBehavior   = flyBehavior;
     QuackBehavior = quackBehavior;
 }
 public RubberDuck(
     IFlyBehavior flyBehavior,
     IQuackBehavior quackBehavior)
 {
     FlyBehavior   = flyBehavior;
     QuackBehavior = quackBehavior;
 }
Exemple #4
0
 public Duck(IQuackBehavior quackBehavior,
             IFlyBehavior flyBehavior,
             IDisplayBehavior displayBehavior)
 {
     _quackBehavior   = quackBehavior;
     _flyBehavior     = flyBehavior;
     _displayBehavior = displayBehavior;
 }
        public Duck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior, ISwimBehavior swimBehavior)
        {
            _flyBehavior   = flyBehavior;
            _quackBehavior = quackBehavior;
            _swimBehavior  = swimBehavior;

            Console.WriteLine("I'm created!");
        }
Exemple #6
0
 public Duck(
     IDisplayBehavior displayBehavior,
     IQuackBehavior quackBehavior,
     IFlyBehavior flyBehavior)
 {
     this._displayBehavior = displayBehavior;
     this._quackBehavior   = quackBehavior;
     this._flyBehavior     = flyBehavior;
 }
Exemple #7
0
 public Duck(
     FlyBehavior flyBehavior,
     QuackBehavior quackBehavior,
     DisplayBehavior displayBehavior)
 {
     this.flyBehavior_     = flyBehavior;
     this.quackBehavior_   = quackBehavior;
     this.displayBehavior_ = displayBehavior;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="duck">Duck Object</param>
 /// <param name="setBehavior">Pass true if you want to set Duck Behavior</param>
 /// <param name="fb">Pass IFlybehavior if setBehavior is true else pass null</param>
 /// <param name="qb">Pass IQuackBehavior if setBehavior is true else pass null</param>
 static void ShowDuck(Duck duck,bool setBehavior,IFlyBehavior fb,IQuackBehavior qb)
 {
     if (setBehavior)
     {
         if(fb != null)
             duck.SetFlyBehavior(fb);
         if(qb != null)
             duck.SetQuackBehavior(qb);
     }
     duck.Display();
     duck.PerformQuack();
     duck.PerformFly();
     Duck.Swim();
 }
 public void SetQuackBehavior(IQuackBehavior behavior)
 {
     _quackBehavior = behavior;
 }
Exemple #10
0
 public ModelDuck(IFlyBehavior fb, IQuackBehavior qb, ISwimBehavior sb) : base(fb, qb, sb)
 {
 }
Exemple #11
0
 public void SetQuackBehavior(IQuackBehavior qb)
 {
     _quackBehavior = qb;
 }
Exemple #12
0
 public MallardDuck(IQuackBehavior quackBehavior, IFlyBehavior flyBehavior) : base(quackBehavior, flyBehavior)
 {
 }
Exemple #13
0
 protected void SetQuackBehavior(IQuackBehavior quackBehavior) => _quackBehavior  = quackBehavior;
Exemple #14
0
 public MallardDuck(IFlyBehavior _flyBehavior, IQuackBehavior _quackBehavior)
 {
     flyBehavior   = _flyBehavior;
     quackBehavior = _quackBehavior;
 }
Exemple #15
0
 public void SetQuackBehavior(IQuackBehavior quackBehavior)
 {
     _quackBehavior = quackBehavior ?? throw new ArgumentNullException();
 }
 public MallardDuck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior) : base(flyBehavior, quackBehavior) {
     
 }
Exemple #17
0
 public void setQuackBehavior(IQuackBehavior qb)
 {
     QuackBehavior = qb;
 }
Exemple #18
0
 public RubberDuck(IFlyBehavior fb, IQuackBehavior qb) : base(fb, qb)
 {
 }
 public Duck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior)
 {
     this.flyBehavior = flyBehavior;
     this.quackBehavior = quackBehavior;
 }
 public void SetQuackBehavior(IQuackBehavior qb)
 {
     this.quackBehavior = qb;
 }
Exemple #21
0
 public void alterarQuackBehavior(IQuackBehavior qb)
 {
     quackBehavior = qb;
 }
Exemple #22
0
 public Duck(IFlyBehavior fb, IQuackBehavior qb, IDisplayBehavior db)
 {
     this.fb = fb;
     this.qb = qb;
     this.db = db;
 }
Exemple #23
0
 protected Duck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior)
 {
     this.flyBehavior = flyBehavior;
     this.quackBehavior = quackBehavior;
 }
Exemple #24
0
 public void SetQuackBehavior(IQuackBehavior quackBehavior)
 {
     _quackBehavior = quackBehavior;
 }
Exemple #25
0
 public void SetQuackBehavior(IQuackBehavior quackBehavior)
 {
     this.quackBehavior = quackBehavior;
 }
 public RedheadDuck(IQuackBehavior qb, IFlyBehavior fb) : base(qb, fb)
 {
 }
Exemple #27
0
 public Duck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior)
 {
     this._flyBehavior   = flyBehavior;
     this._quackBehavior = quackBehavior;
 }
Exemple #28
0
 public void SetQuack(IQuackBehavior quacker)
 {
     this.quackBehavior = quacker;
 }
Exemple #29
0
 // Can dynamically set its behaviors
 public ModelDuck(IFlyBehavior fb, IQuackBehavior qb)
 {
     quackBehavior = qb;
     flyBehavior   = fb;
 }
Exemple #30
0
 public ModelDuck(IFlyBehavior fb, IQuackBehavior qb) : base(fb, qb)
 {
 }
Exemple #31
0
 public Duck(IFlyBehavior flybh, IQuackBehavior qukbh)
 {
     flyBehavior   = flybh;
     quackbehavior = qukbh;
 }
Exemple #32
0
 public void SetQuackBehavior(IQuackBehavior quackBehavior) => this.quackBehavior = quackBehavior;
 public ModelDuck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior) : base(flyBehavior, quackBehavior) {
     
 }
Exemple #34
0
 public void setQuackBehavior(IQuackBehavior qb)
 {
     quackBehavior = qb;
 }
Exemple #35
0
 public ModelDuck()
 {
     flyBehavior   = new FlyNoWay();
     quackBehavior = new Quack();
 }
Exemple #36
0
 public DuckCall()
 {
     _quackBehavior = new Quack();
 }
Exemple #37
0
 public DecoyDuck(IFlyBehavior fb, IQuackBehavior qb) : base(fb, qb)
 {
 }
Exemple #38
0
 public void SetQuackBehavior(IQuackBehavior behavior)
 {
     quackBehavior = behavior;
 }
Exemple #39
0
 public Duck()
 {
     flyBehavior   = null;
     quackBehavior = null;
 }
Exemple #40
0
 public void SetQuackBehavior(IQuackBehavior qb)
 {
     _quackBehavior = qb;
 }
Exemple #41
0
 public void SetQuackBehavior(IQuackBehavior qck)
 {
     this.quackBehavior = qck;
 }