Conditional code

Hi,
Is there any way to build different code for the same class in ROOT 5 and 6 framework? like:

class MyClass{
#ifdef __ROOT5__
Amember A;
#endif
#ifdef _ROOT6__
Bmember A;
#endif;

Search for “ROOT_VERSION” and “ROOT_VERSION_CODE” in “${ROOTSYS}/include/*” files (e.g. see “RVersion.h”).

Thank you.