On Mar 28, 2:00 am, "muler" <mulugeta.abe...@gmail.comwrote:
"If an instance method declaration includes the sealed modifier, it
must also include the override modifier." The C# Programming Language,
§ 10.5.5 Sealed Methods
Why is this?
Thanks,
Mulugeta
It wouldn't make sense for a method declaration to be marked with
sealed and not override. The sealed keyword is used to prevent
further implementations of the method in derived classes. The only
way that could happen in the first place is if the method was marked
virtual in a base class. Overriding virtual methods in derived
classes requires the override keyword. And of course it doesn't make
sense to use sealed and virtual at the same time either because if you
didn't want the method to be overridable then you wouldn't have marked
it with the virtual keyword to begin with.
Brian