Abstract Factory pattern | What is benefits with so many interfaces
Hi First thing first. Please find below codes samples created for Factory pattern and Abstract factory pattern. Correct me if any thing wrong is observed in these example codes. https://code.sololearn.com/cA2A10A124a1 https://code.sololearn.com/cA16a1a14A20 Now, question is about usefulness. what benefit we gets from abstract factory? In case of factory method , main function (i.e. client) does not know how object is created and it is the benefit that object creation is hidden from end user. Another benefit is that with addition of new flavor, client code i.e. main function need not to be changed. In contrast to this, abstract factory pattern creates required object in main function itself... So, both the advantage I mentioned for factory pattern is gone in this case....Another disadvantage is addition of virtual keyword which increases cost at run time. So, what is benefit of using abstract pattern?