Factory method
It provides an interface for creating objects in a superclass dynamically, while allowing subclasses to customize the creation process.
It provides an interface for creating objects in a superclass dynamically, while allowing subclasses to customize the creation process.
Let's suppose that you have a car object that has some attributes like color, license, model, etc. in this case you have a red car with the license plate MMX502 and you need to create the same car in another object like a copy car2 because you need the exact same attributes and to change some other attributes like the license plate.