Consider following code:
#include // ============================= class Shape{ public: virtual ~Shape(){}; virtual void process
Your factories are passing around ownership. There's another alternative to that aspect; instead of passing around ownership, you can make the factory own the objects:
class Factory { public: ~Factory() { for(int i=0;i vec; };