J
joe
Happy New Year to you all and may the source be with you!
I have a class, which handles an event and I derive from
this class. I dont want the event handler in the base
class to be called anymore as it does things I dont want
it to do. I want to handle the event in the derived class.
How do I do it?
One way is to declare the event handler in the base class
as protected virtual.
Is there another way?
class A
{
public ClassWithEventCalledMyEvent c;
this.c.MyEvent+=new EventHandler(MyEventHandler);
private void MyEventHandler(...)
{
// I DONT WANT THIS CALLED IN THE DERIVED CLASS
}
}
class B:A
{
this.MyEvent+=new EventHandler(MyDerivedEventHandler);
private void MyDerivedEventHandler(...)
{
// I WANT THIS CALLED ONLY
}
}
Thanks,
I have a class, which handles an event and I derive from
this class. I dont want the event handler in the base
class to be called anymore as it does things I dont want
it to do. I want to handle the event in the derived class.
How do I do it?
One way is to declare the event handler in the base class
as protected virtual.
Is there another way?
class A
{
public ClassWithEventCalledMyEvent c;
this.c.MyEvent+=new EventHandler(MyEventHandler);
private void MyEventHandler(...)
{
// I DONT WANT THIS CALLED IN THE DERIVED CLASS
}
}
class B:A
{
this.MyEvent+=new EventHandler(MyDerivedEventHandler);
private void MyDerivedEventHandler(...)
{
// I WANT THIS CALLED ONLY
}
}
Thanks,