Summary: Factory Method Pattern of Design Patterns

Factory Method pattern diagram

------------------------------------------------------------------------------------------------------------

Participating roles:

------Product (product): Define the interface held by the product instance generated in the schema.

------Creator: The abstract class responsible for generating the Product role.

------ConcreteProduct (specific product): determine the specific product.

------ConcreteCreator (specific creator): responsible for generating specific products.

------Test (test class)

Specific case:

---Product:

---Creator:

---ConcreteProduct:

---ConcreteCreator:

---Test:

------------------------------------------------------------------------------------------------------------

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325404753&siteId=291194637