abstract factory pattern C++