Patrones de Diseño Episodio 2
Patrón Fábrica
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 2 / 2

What is the downside of using multiple make methods, like in the example below:

class WeaponFactory
{
    public function makeSword(): WeaponInterface
    {
        return new Sword(Dice::rollRange(4, 8), 12);
    }

    public function makeAxe(int $bonusDamage = 0): WeaponInterface
    {
        return new Axe($bonusDamage + Dice::rollRange(6, 12), 8);
    }
}
Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.