Getting notification on member-variable vvalue change

Hi,

I want to get notification on modification of some class member-variable(may be primitive or user-defined).

Can anyone let me know how to achieve this.

Thanks
Make it private and changeable only with a call to a public member function. Have that function make the change, and alert you.
Any other way beside this.... i mean some support from lang/compiler for getting this.

In fact I have scenario something like

I have existing menu and menu-items. Now I am putting all these menu-items on toolbar. Since when these menu-items was inside menu-item I get event ON_UPDATE_COMMAND_UI where I call a function and update menu-items states.

But now for toolbar I have to put function for checking state every time, variables(which are many in number and also gets modified at many state, for which I have no control).

Can anyone suggest me some good alternative, without changing the existing code, since it's very fragile.
Copy the state of all variables of interest into some storage object.

When they might have changed, compare the new state with the old and if any are different, trigger alert.
How and when would I come to know that the state is changed? Even I can't use observer pattern, since i am working on some legacy code where these variables are public with many holes in it, so i can't capture these change event on these variables.

I was wondering if there is some support by lang/compiler, the way the watch variable do when we use visual studio debugger.
Can you at least read the variables? Is that possible?
Yes I can read those variable.


But i want to get notified whenever these variables gets changed.
So make something that reads those variables over and over and over again forever, and tells you when they change.
Topic archived. No new replies allowed.