Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Simple factory model

Shulou Source: shulou.com Published: 2022-06-03 05:26:41 11月24日 Update

The simple factory pattern is an innovative pattern of classes, also known as static factory method pattern (Static FactoryMethod Pattern), which is responsible for creating instances of other classes by defining a class specifically, and the created instances usually have a common parent class. In the past, we didn't know about simple factories. Every time we need to use an object class, we first need to know the file path that contains the class, and we need to include the header file of the class. When we need to use a lot of classes to implement a function, we will find that we need to include a large number of header files, which is particularly uncomfortable. So is it possible to have a class that specifically manages these class? The answer is yes. The simple factory mentioned this time implements this function, and its responsibility is particularly simple, which is to create an instance of the class and return it to the superior.

`

Tags: Factory pattern instance file function that is time superior innovation object feeling method answer responsibility path static management affirmation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info Linux MySQL Docker