In my code, I have 2 seperate data access classes, both of which inherit from an abstract base class (to ensure a uniform interface)
What I want to be able to do is to look at a registry setting, and from this see if the application is configured to use class a or b, and then create my data access class accordingly. At the moment I am including both headers in each file that might need data access, and and then in my code looking at the registry, and saying
if (value == FILE_BASED)
{create a file based access object)
else if
(value == DATA_BASED)
{create a data base object}
There has to be a better method than this, but the only other one I can think of is to compile 2 versions of my project, one for each method. (Which seems harder to maintain to me)
I am guessing that I might need to use dll's for this, but I dont know, so any help will be greatfully recieved !
K
What I want to be able to do is to look at a registry setting, and from this see if the application is configured to use class a or b, and then create my data access class accordingly. At the moment I am including both headers in each file that might need data access, and and then in my code looking at the registry, and saying
if (value == FILE_BASED)
{create a file based access object)
else if
(value == DATA_BASED)
{create a data base object}
There has to be a better method than this, but the only other one I can think of is to compile 2 versions of my project, one for each method. (Which seems harder to maintain to me)
I am guessing that I might need to use dll's for this, but I dont know, so any help will be greatfully recieved !
K