Changing the value of a macro at run time
Posted
by
BrandiNo
on Stack Overflow
See other posts from Stack Overflow
or by BrandiNo
Published on 2013-10-25T03:50:17Z
Indexed on
2013/10/25
3:53 UTC
Read the original article
Hit count: 97
macros
I'm working in Visual Studio 2010, using C++ code. What I'm trying to do is change the value of a preprocessor directive during run time, not sure if it's possible but i've tried this..
somefile.h
static int mValue = 0;
#define POO = mValue;
...
#if POO 0
//define class methods
#else
//define class methods differently
}
main.cpp
main() { //Code calls constructor and methods allowed when POO is 0 //Code increments mValue //Code calls constructor and methods allowed when POO is 1 }
How can POO be changed so that class objects uses a different implementation of other methods? Or if it's not possible, what's a another approach to this?
© Stack Overflow or respective owner