How to implement the factory method pattern in C++ correctly
问题 There\'s this one thing in C++ which has been making me feel uncomfortable for quite a long time, because I honestly don\'t know how to do it, even though it sounds simple: How do I implement Factory Method in C++ correctly? Goal: to make it possible to allow the client to instantiate some object using factory methods instead of the object\'s constructors, without unacceptable consequences and a performance hit. By \"Factory method pattern\", I mean both static factory methods inside an