Chapter 16. Factory Method
As a class developer, you will ordinarily provide class constructors to let users of your class instantiate it. Sometimes, however, a client that needs an object does not or should not know which of several possible classes to instantiate. The FACTORY METHOD pattern lets a class developer define the interface for creating an object while retaining control of which class to instantiate.
Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.