Factory design pattern in c

broken image
broken image

Factory method design pattern is a way to create object but the client or calling class will not know about how the objects were created. This something is nothing but the objects. Factory Method Design PatternĪs the name Factory indicates that it will create something. It helps you to create objects in a different way. If you will add one more condition, then one more new keyword will be required.

broken image

Lot of new keyword: The above code implements lot of new keyword which increases your client code complexity and also increases maintenance requirement.The above example generates objects of different classes after checking a condition.

broken image