C++ The Modern Factory

The Implementation Details


This code is compiled and tested in Visual Studio 2017, with the latest MSVC as of 2018 June. This is not a “production code” it is more of a “proof of concept”. In case of bugs found, just wishing to comments or whatever please do not hesitate to contact me.

Eagle eyed reader might jump on me using inheritance even in this modern factory.  And native pointer, gasp!  My answer: I know about Polymorphism without inheritance. It is not the focus of this post. It might be in very near future in some future post on this same subject.

Also in this architecture, this is also an “implementation detail”. So do we use it and will we change it, is completely hidden from the client code, that will work unchanged, in case of changes.

I hope you will be able to apply this rather improved factory pattern to your use cases and projects.