
This is a simple yet interesting object factory. Main points are: - Support for many class hierarchies at the same time - Object constructor arguments with generic type - Object constructor overloading - Support for user supplied 'object create' functions - Dynamic class registering/unregistering - No RTTI or special library requirements, only an associative container is used. - And finally the most important: 100% type safe also at runtime Especially constructor overloading and runtime type safety are two niceties you won't find easily googling around. You can view as HTML page a simple and commented test program here: http://digilander.libero.it/mcostalba/simple_factory/main.cpp.html A page with the source is here: http://digilander.libero.it/mcostalba/simple_factory/simple_factory.hpp.html Below are the links to the actual files: http://digilander.libero.it/mcostalba/simple_factory/main.cpp http://digilander.libero.it/mcostalba/simple_factory/simple_factory.hpp I'm sorry if you find the comments a bit "entry level", but they are intended for a wider audience. Finally there are a couple of bugs that I won't reveal ;-) they are not easy to spot and fixing them will complicate the code. Because this is intended more as a presentation of the ideas then production code I will fix them when I'll be confident design is sound. Anyhow I keep a separated test framework with about 40 tests to exercise the factory under different paths. So I would say this is 'working' code. Any comment or hint on how to improve the design or implementation would be very appreciated. Thanks Marco