I have two objects, ObjectA and ObjectB. ObjectA needs to call events on ObjectB. I was looking for a good design pattern to allow ObjectA to do this, because I don’t want to expose public methods for anyone to do this, yet ObjectA really needs to do the work of firing those events.
Is there a good pattern for this, or any advice?
Thanks.
well the way you describe it sounds like A sending commands to B, which makes Command pattern a usual suspect.
Also the way to establish close encounters between A and B may turn out complicated enough to justify establishing a separate object C to mediate their interaction – Mediator pattern