I have an abstract class that about a dozen sub-classes inherit from. I want to enforce that each sub-class shadows an event in the abstract class, but can't quite figure out how to do this.
Basically, all of the inherited classes deal with data in some way or another. I need to make sure that when the data is changed on any of those classes, they raise an event called "DataChanged", and have that enforced in some way from the abstract class.
I've tried a number of approaches, including "MustOverride Event", which apparently isn't allowed. Also, I've created an interface with just the DataChanged event, but there doesn't appear to be any sort of "Must Implement" available --- to make matters worse, when trying to raise an event from the inherited class on the abstract class, that doesn't appear to be allowed either.
Obviously I can create an interface and just "remember" that every one of the sub-classes must implement this interface, but that's error prone and relies on me remembering additional steps, which obviously isn't a good idea.
Any suggestions?
Basically, all of the inherited classes deal with data in some way or another. I need to make sure that when the data is changed on any of those classes, they raise an event called "DataChanged", and have that enforced in some way from the abstract class.
I've tried a number of approaches, including "MustOverride Event", which apparently isn't allowed. Also, I've created an interface with just the DataChanged event, but there doesn't appear to be any sort of "Must Implement" available --- to make matters worse, when trying to raise an event from the inherited class on the abstract class, that doesn't appear to be allowed either.
Obviously I can create an interface and just "remember" that every one of the sub-classes must implement this interface, but that's error prone and relies on me remembering additional steps, which obviously isn't a good idea.
Any suggestions?