jeudi 26 octobre 2023

Why to use factory pattern

I am trying to understand the Factory Method design pattern and i have come across multiple questions similar to the one on my mind but my question still remains unanswered.

this is the article I am referring in my question

In the example mentioned in above article why do we need a concrete factory of HtmlDialog and WindowsDialog and at the main method choose one of the implementations of Dialog, instead of directly choosing the implementation of Button from the available HtmlButton and WindowsButton

Aucun commentaire:

Enregistrer un commentaire