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; }
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!"); }
public Duck( IDisplayBehavior displayBehavior, IQuackBehavior quackBehavior, IFlyBehavior flyBehavior) { this._displayBehavior = displayBehavior; this._quackBehavior = quackBehavior; this._flyBehavior = flyBehavior; }
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; }
public ModelDuck(IFlyBehavior fb, IQuackBehavior qb, ISwimBehavior sb) : base(fb, qb, sb) { }
public void SetQuackBehavior(IQuackBehavior qb) { _quackBehavior = qb; }
public MallardDuck(IQuackBehavior quackBehavior, IFlyBehavior flyBehavior) : base(quackBehavior, flyBehavior) { }
protected void SetQuackBehavior(IQuackBehavior quackBehavior) => _quackBehavior = quackBehavior;
public MallardDuck(IFlyBehavior _flyBehavior, IQuackBehavior _quackBehavior) { flyBehavior = _flyBehavior; quackBehavior = _quackBehavior; }
public void SetQuackBehavior(IQuackBehavior quackBehavior) { _quackBehavior = quackBehavior ?? throw new ArgumentNullException(); }
public MallardDuck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior) : base(flyBehavior, quackBehavior) { }
public void setQuackBehavior(IQuackBehavior qb) { QuackBehavior = qb; }
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; }
public void alterarQuackBehavior(IQuackBehavior qb) { quackBehavior = qb; }
public Duck(IFlyBehavior fb, IQuackBehavior qb, IDisplayBehavior db) { this.fb = fb; this.qb = qb; this.db = db; }
protected Duck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior) { this.flyBehavior = flyBehavior; this.quackBehavior = quackBehavior; }
public void SetQuackBehavior(IQuackBehavior quackBehavior) { _quackBehavior = quackBehavior; }
public void SetQuackBehavior(IQuackBehavior quackBehavior) { this.quackBehavior = quackBehavior; }
public RedheadDuck(IQuackBehavior qb, IFlyBehavior fb) : base(qb, fb) { }
public Duck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior) { this._flyBehavior = flyBehavior; this._quackBehavior = quackBehavior; }
public void SetQuack(IQuackBehavior quacker) { this.quackBehavior = quacker; }
// Can dynamically set its behaviors public ModelDuck(IFlyBehavior fb, IQuackBehavior qb) { quackBehavior = qb; flyBehavior = fb; }
public ModelDuck(IFlyBehavior fb, IQuackBehavior qb) : base(fb, qb) { }
public Duck(IFlyBehavior flybh, IQuackBehavior qukbh) { flyBehavior = flybh; quackbehavior = qukbh; }
public void SetQuackBehavior(IQuackBehavior quackBehavior) => this.quackBehavior = quackBehavior;
public ModelDuck(IFlyBehavior flyBehavior, IQuackBehavior quackBehavior) : base(flyBehavior, quackBehavior) { }
public void setQuackBehavior(IQuackBehavior qb) { quackBehavior = qb; }
public ModelDuck() { flyBehavior = new FlyNoWay(); quackBehavior = new Quack(); }
public DuckCall() { _quackBehavior = new Quack(); }
public DecoyDuck(IFlyBehavior fb, IQuackBehavior qb) : base(fb, qb) { }
public void SetQuackBehavior(IQuackBehavior behavior) { quackBehavior = behavior; }
public Duck() { flyBehavior = null; quackBehavior = null; }
public void SetQuackBehavior(IQuackBehavior qck) { this.quackBehavior = qck; }