Greetings,

Another ridiculous question. I highly doubt it is possible to do the following but I might as well ask first.

Is there a way for a member function to know which object called it?
Assume the following:
Code:
class A
{
void DoSomething();
}

class B
{
A* pA;
void SetAPointer(A* p){pA = p};
}

class C
{
A* pA;
void SetAPointer(A* p){pA = p};
}
and then in the code we do:
Code:
A my A;
B myB;
myB.SetAPointer(&A);
C myC;
myC.SetAPointer(&A);

myB.pA->DoSomething();
myC.pA->DoSomething();
The question is, inside those two last calls, inside DoSomething() is it possible to know who called it? Perhaps some way of getting the pointer to the object calling it?

Thanks