Currently I have a
//ModelFac.h Class ModelFac: public Singleton <ModelFac>{ public: int CreateModelA (a list of arguments); int CreateModelB (another list of arguments);// CreateModelA and CreateModelB have different function implementations };
When I want to call functions, I will call ModelFac::Instance().CreateModelA(args)
. Those functions are being called in different .cc
files. However when I add new CreateModelC
function, all files that calls ModelFac::Instance().CreateModelX(different args)
will need to be recompiled since they all include ModelFac.h
, which is really time consuming.
Can I somehow fix this situaion but still leave ModelFac::Instance().CreateModelA(args)
this type of call format for implementation?
I don't want to make different classes for different CreateModel
functions, which will cause a lot fixes in the whole program. It will be greate if I can still use ModelFac::Instance()
but then pass CreateModelA
as the first argument.
Thanks.
Aucun commentaire:
Enregistrer un commentaire