I want to implement the observer pattern and I want class X to observe updates in classes A and B.
X is derived from the abstract base class XObs which has the update() function taking an enum as parameter of what has happened.
The logical problem here is that X needs to know which of A and B sent the update and X cannot determine that from the enum parameter.
What are the pros/cons of adding another parameter to update() which tells which of A and B sent the update? What other ways are possible to solve this? (I rather not create a base class for A and B and send a this pointer in the update() as A and B are quite different.)
Thanks,
Tomas