What are the practical uses of Factory Method Pattern?

前端 未结 6 910
闹比i
闹比i 2021-01-11 09:51

I\'m pretty new to Design Patterns.I just came across Factory Design Pattern. I understood that it delegates the instantiation to subclasses. But I didn\'t get the actual ap

6条回答
  •  臣服心动
    2021-01-11 10:19

    I've used it for plugins to applications... this way you can have your main application call the class factory to instantiate the specific plugin implementing some interface that you've developed to in your main app. This way, you can code the main portion of your application without ever needing to know what is going to be plugged in.

提交回复
热议问题