Summer SALE
Factory Method

Factory Method in Rust

Factory method is a creational design pattern which solves the problem of creating product objects without specifying their concrete classes.

The Factory Method defines a method, which should be used for creating objects instead of using a direct constructor call (new operator). Subclasses can override this method to change the class of objects that will be created.

If you can’t figure out the difference between various factory patterns and concepts, then read our Factory Comparison.

Factory Method in Other Languages

Factory Method in C#Factory Method in C++Factory Method in GoFactory Method in JavaFactory Method in PHPFactory Method in PythonFactory Method in RubyFactory Method in SwiftFactory Method in TypeScript