I'm writing some code where I have have a class that implements 4 methods
(class A)
I only want to call these methods from the base class if they have been
overridden in a sub class (Class B) I guess I could have some properties
that specify wether to call the methods, but I would like to call them
automatically when they are overridden, how do I do this using reflection?
Class A
{
private void methodX()
{
//some code
calculate bool a and call methodY if it has been overridden
calculate bool b and call methodZ if it has been overridden
//some code
}
public virtual void methodY(bool a)
{
//empty
}
public virtual void methodZ(bool b)
{
//empty
}
}
public class B : A
{
override void methodY(bool a)
{
//some code
}
}
so when an instance of class B has methodX called I want it to calculate
bool d and call methodY
Bool a and b are complex to calculate so I don't want to calculate them
unless I need to
Kind Regards,
Allan Ebdrup