Let's say I have three object A, B, C.
B is the implementation of following interface:
interface D
{
event EventHandler<OrderEventArgs> OrderCreated;
event EventHandler<OrderEventArgs> OrderShipped;
}
I would add two functions in B which will raise the events in the interface.
class B
{
RaiseOrderCreated();
RaiseOrderShipped();
}
A is the hosting class and will call B's functions to raised the specified events. I hope in C I can listen to the interface B or class C, whenever the events in B are raised, C can get notified, then C can have reactive to the events.
I am thinking about how to implement this mechanism in C# and Java.
Any help or hints will be great appreciated !