Event and inheritance

Hi All

I have a super class called myBaseClass which implements an event (say myEvent)
I have different subclasses based on myBaseClass (say subclasses1 and subclasses2)
I have something that must use one of these subclasses whatever it is and need to receive calls from myEvent (with “AddHandler”).
→ it is impossible in subclasses1 or subclasses2 to raise myEvent !
The strange thing is that this event is known outside (for adding addhandler) but not by the derived subclasses.
So my workaround is adding a method in myBaseClass only to raise the event.
It doesn’t look very optimized to me…
Does someone has an other idea ?

You can only use RaiseEvent from inside a class - you can’t order a class instance to fire an event from the outside. Sounds like you’ve figured that out; is that the answer you’re looking for?

…from outside, no but from a subclass of the class where the event is declared why not ?
Why events are declared as private and not “protected” ?

You can use fancy footwork to achieve that design like this:

yes, that is my workaround.

It’s an issue that has been discussed for a long time …

That is the correct approach.