Hello everyone,
There is well known recommendation not to include into class interface method that returns a pointer (or a reference) to private data of the class.
But what do you think about method of a class that sends to another class a pointer to the private data of the first one. For example:
class A
{
public:
void fA(void) {_b.fB(&_var)};
private:
B _b;
int _var;
};
I think that it is some sort of data hiding damage: the private data define state of their own class, so why should one class delegate changes of its own state to another one? What do you think?
Denis