I have a problem, and I am almost certain I can find a solution by restructuring the code I have to eliminate the problem, but I was wondering if there was a way to achieve the same result with what I have right now.
Suppose we have class A:
class A
{
public:
int thing;
void dostuff();
std::list<B> mList;
}
void A::doStuff()
{
for(auto x : mList)
x.doMoreStuff();
}
And then there is class B.
class B
{
void doMoreStuff();
}
Is it possible in any way to make B's doMoreStuff change the 'int thing' variable of class A without passing the instance of class A to B or similar convoluted methods?
B.doMoreStuff();supposed to mean?