Type Here to Get Search Results !

What is a "factory method"?

0

 What is a "factory method"?

A) A method that creates a new instance of a class.
B) A method that retrieves an object from memory.
C) A method that destroys an instance of a class.
D) A method that overrides a superclass method.

Answer: A) A method that creates a new instance of a class.

Explanation: A factory method is a design pattern that provides an interface for creating instances of a class, with subclasses deciding which class to instantiate. This pattern promotes loose coupling and allows for flexibility in object creation, making it easier to manage and extend.

Post a Comment

0 Comments