Factory method pattern
A creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created.
Creating objects without having to specify the exact class of the object that will be created.
This is done by creating objects by calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.
in C++
"the concept of redirecting the normal way of instantiation of class X to anywhere else than the constructor"
class FooFactory {
public:
Foo* createFooInSomeWay() {
return new Foo(some, args);
}
};