Answer:
a) Abstract Factory can be use while we need to produce multiple factories (for producing multiple items) which it does through multiple factory methods via composition whereas in case of factory pattern, the object creation happens through a single factory method for only one single item.
b) Another difference that we can say is that, in the case of Factory the object creation happens directly through the class instance of the factory (we can use DP but again underlying the same stuff) as opposed to the Abstract Factory where it happens through interface
Asked In: Many Interviews |
Alert Moderator