Link to home
Start Free TrialLog in
Avatar of axnst2
axnst2Flag for United States of America

asked on

abstract events

Hi Experts,

When I try to compile the attached code, I get the following errors:

<'CMyClass' does not implement inherited abstract member 'CMyBaseClass.ErrorEvent.add'>

Also, when I go to add the "ErrorEvent" event in CMyClass, the event doesn't come up on the list of available events.

Any ideas?


abstract class CMyBaseClass
{
    protected delegate void ErrorEventDelegate(string error);
    protected abstract event ErrorEventDelegate ErrorEvent;
}

class CMyClass : CMyBaseClass
{
    public CMyClass()
    {
        base.ErrorEvent += new ErrorEventDelegate(CMyClass_ErrorEvent);
     }

    void CMyClass_ErrorEvent(string error)
    {
        throw new Exception("The method or operation is not implemented.");
    }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ajitha75
ajitha75
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of axnst2

ASKER

I have an abstract event so that the inhereted class is forced to have to subscribe to/implemnt it.