I wondered if anyone knew how to tell whether a variable has been accessed in memory, no matter what it's been used for... Whether it's actually been set to something else, or whether it's been get for an operation or function call that doesn't actually do anything to affect the variable itself. Either way the variable has been "accessed" for something.
I'm not entirely certain that it's possible to detect a program getting the variable but I know that programs exist where they can trace what has accessed a certain part of memory... CheatEngine is one example, although I'm not entirely sure whether this can only detect changes in the variable and then trace what did it.
(dbx) stop access r &x,sizeof(x)
(2) stop access ra &x, sizeof(x)
(process id 3760)
watchpoint ra &x, sizeof(x) (0x20e20) at line 8 in file "test.cc"
8 printf("%d", x);
=> g(), line 8 in "test.cc"
 f(), line 13 in "test.cc"
 main(), line 18 in "test.cc"
The variable isn't encapsulated, it's just a standard C++ primitive variable.
Also I thought using the get property was only a Java/C# thing... I've not really looked into it that much so I don't really know.
Smac89, cheers, not entirely sure if it's answer to the question I was asked but that's exactly what I need for my code (again I've not really looked into these either)... Suppose I was going about it in an awkward way.