You are absolutely right: the author suggested that you are not going to subclass SimpleFactory , which is not a fair assumption (if SimpleFactory not marked final ).
Since SimpleFactory not final, you can subclass it with more flexibility than the factory method, because SimpleFactory replaces inheritance with composition.
An even better approach would be to create a SimpleFactory interface. This will allow you to choose a composition or inheritance according to your preferences, as the interface will not limit you when your Store class already inherits the class.
public interface SimpleFactory { Product createProduct(); }
Then you can use either composition
public class FactoryImpl implements SimpleFactory { public Product createProduct(){
or a combination of inheritance / composition
public class StoreInheritance implements SimpleFactory { SimpleFactory factory = this; public Product createProduct(){
source share