public void main() { Duck mallard = new MallardDuck(); mallard.display(); mallard.performQuack(); mallard.performFly(); }
public void main() { Duck mallard = new MallardDuck(); mallard.display(); mallard.performQuack(); mallard.performFly(); // otro pato Duck model = new ModelDuck(); model.display(); model.performQuack(); model.performFly(); //cambio de vuelo model.setFlyBehavior(new FlyRocketPowered()); model.performFly(); }