Now that you have learned the Factory method and Abstract Factory method, let's see the comparison of the two:
Factory method |
Abstract Factory method |
---|---|
This exposes a method to the client to create the objects |
Abstract Factory method contains one or more factory methods to create a family of related objects |
This uses inheritance and subclasses to decide which object to create |
This uses composition to delegate responsibility to create objects of another class |
The factory method is used to create one product |
Abstract Factory method is about creating families of related products |
18.190.155.49