You are creating a framework for applications that can present multiple document...
✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
You are creating a framework for applications that can present multiple documents to the user. Two key abstractions in this framework are the classes Application and Document. Both classes are abstract, and clients have to subclass them to realize their application-specific implementations. To create a drawing application, for example, we define the classes DrawingApplication and DrawingDocument. The Application class is responsible for managing Documents and will create them as required—when the user selects Open or New from a menu. Because the particular Document subclass to instantiate is application-specific, the Application class can't predict the subclass of Document to instantiate — the Application class only knows when a new document should be created, not what kind of Document to create. This creates a design problem: The framework must instantiate classes, but it only knows about abstract classes, which it cannot instantiate. What design pattern would you use to solve this problem? Explain your decision.