Question: In the previous segment on Factory pattern, you created a superhero called The Magician from The Revengers team. You applied the Factory pattern to assign
In the previous segment on Factory pattern, you created a superhero called The Magician from The Revengers team. You applied the Factory pattern to assign certain actions to the superhero. Let us continue the same example and try to assign certain features to The Magician.
You have to assign name, suitType, weapon, eye color, numberOfActions to all the superheroes from The Revengers.
This will be achieved thrugh major steps:
Create the Revenger class which will call the Builder functions
Create the Builder class which will define all the major features of the superhero
Write the client code
Before applying the Builder pattern, the client code will look like this:
public TheRevengerString name, SuitType suitType, Weapon weapon, EyeColor eyeColor, NumberOfActions numberOfActions
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
