Dahua design pattern---factory pattern

 In relative object programming, the function of a program can be divided into multiple subclasses, one function and one class. These subclasses inherit the parent class, and when the parent class calls each method, the corresponding child can be called polymorphically. It's the factory.

    The benefits of the factory pattern: Turn functions into corresponding modules. When the parent class uses the corresponding function subclass, as long as there is a reference, it will be instantiated when it is called. Can greatly improve the flexibility and maintainability of the code

Guess you like

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