I want to track when a member variable changes value, so I can print it. Now the obvious solution for this is to add a tracking function to the member method Set, for example:
class Foo
{
public:
Foo() {}
void SetBar(int value)
{
m_bar = value;
}
private:
int m_bar;
};
The problem I am facing is that I am working on a huge project, and some classes have many methods that internally change member variables instead of calling their Setters.
m_bar = somevalue;
Instead:
SetBar(somevalue);
So, I am wondering if there is a faster / cleaner method for achieving what I want, than just changing each m_bar =to SetBar(. An assignment operator can only overload this member variable, perhaps?