Saturday, October 6, 2007

Duck.cs

public abstract class Duck
{
protected IFlyBehavior flyBehavior;
protected IQuackBehavior quackBehavior;

public abstract object Display();
public object PerformFly() { return flyBehavior.Fly(); }
public object PerformQuack() { return quackBehavior.Quacking(); }
public string Swim() { return "All ducks float, even decoys!"; }
public void setFlyBehavior(IFlyBehavior fb) { flyBehavior = fb; }

}
blog comments powered by Disqus