I have a class hierarchy like bellow:
class A
{
event evA<ArgA>
Run(){
evA.Invoke()
}
}
class B
{
event evB<ArgB>
Run(){
evB.Invoke()
}
}
class C
{
even A<ArgA> //?
event B<ArgB> //?
event C<ArgC>
A a;
B b;
C(A a, B b)
{
}
void Run()
{
a.Run();
b.Run();
}
}
class D
{
event evD<ArgD>
C c;
D(C c)
{
///in this class I want to ract on event A,B,C
}
Run()
}
Class A has its own event same as the class B and both has different args. Class C uses class A and B as dependency.
Then class C is used in class D as an dependency and runs its methods with causes that all classes A,B,C,D raising their own events.
What is the best approach to get all this events (evA,evB,evC) in class D:
Should I declare event A and B in class C and forward this events or there is some better approach to accomplish this?
Aucun commentaire:
Enregistrer un commentaire