title: Toggle use of class implementation in C++
body: <p>I have a C++ program A.cpp and I'm  including two header files X.h and Y.h. This program(A.cpp) has a class 'foo' and the prototypes of all members of that class. The implementation of this class is done in X.h and Y.h. Both of them contain different definitions of the member functions. But the inclusion of one these files is done conditionally using #ifdef in the program. So if a certain condition is satisified, X.h is #include-ed, else Y.h is #include-ed. Both of them are never included together. Here's the problem: I need to change this compile-time toggle to run-time toggle. I know a header file cannot be included during run-time, so is there any way in which I can "choose" which implementation I want, without using namespaces? Overloading is ruled out, because the functions' prototypes are the same.</p>
  
  <p>Thanks a lot.
  (Sorry if this is stupid. I a newbie in C++)</p>