C
cppaddict
Hi,
I have the following line inside one of my class member functions:
static bool tested = false;
if (!tested) {
MessageBox(NULL, "Hi", "Testing", MB_OK |
MB_ICONEXCLAMATION);
tested = true;
}
The idea, of course, is to have this message box only pop up the first
time the member function is called. However, it doesn't work: the
message box pops up everytime. I know using static inside a normal
function causes the variable to persist. Is there some reason it
won't work inside a member function? Any way I can get it to work?
Thanks for any help,
cpp
I have the following line inside one of my class member functions:
static bool tested = false;
if (!tested) {
MessageBox(NULL, "Hi", "Testing", MB_OK |
MB_ICONEXCLAMATION);
tested = true;
}
The idea, of course, is to have this message box only pop up the first
time the member function is called. However, it doesn't work: the
message box pops up everytime. I know using static inside a normal
function causes the variable to persist. Is there some reason it
won't work inside a member function? Any way I can get it to work?
Thanks for any help,
cpp