The Replace Constructor with Factory Method refactoring allows you to "encapsulate" a constructor with a static method which returns a new instance of a class.
The Factory Method pattern is a way of creating objects without specifying the exact class of object that will be created. A separate method for creating the objects is generated. Subclasses can then override it to specify the derived type of object that will be created.

After replacing this constructor with a factory method, the constructor is made private and a new static factory method is introduced which calls the constructor:

As a result, calls to the constructor, such as shown below:

...are replaced with calls to the new factory method:

To replace a constructor with a factory method
The Replace Constructor with Factory Method dialog box opens.
