Beispiel #1
0
def main():
    duck = MallardDuck()
    duck.swin()
    duck.display()
    duck.performFly()
    duck.performQuack()
    duck.setFlyBehavior(FlyNoWay())
    duck.setQuackBehavior(Squeak())
    duck.performFly()
    duck.performQuack()
Beispiel #2
0
 def __init__(self):
     self.fly_behavior = FlyNoWay()
     self.quack_behavior = Quack()