why do we need a Abstract Factory design pattern to create objects? Why can’t we just use the new operator?
answer is, to avoid tight coupleing of the objects. But I didn’t understand how ? can anyone explain with code (will be very useful).
what makes abstract factory design pattern useful and when.
Thanks in advance.
Harsha T
If you use the
newoperator, you have to specify which exact type you want.Sometimes you want to be more generic, for example because you want to be able to change that instantiated type in all the codebase quickly.