c# - protected members in a sealed class -


I am writing a webpad, which means that I have the system. Web. UI. WebControls Webpart and I override the method protected override zero CreateChildControls () .

However, I want to classify seal , but it gives two issues: Just warning the sealing of the class "new protected members declared in the sealed class" gives.

Access Code from protected to by private or internal returns a compiler error telling me that I Can not change the modifier at the time of

It makes me wonder: is there any problem in sealing and ignoring it? Or can it lead to any negative side effects under the road? seems to work fine, but the devil is usually in the description.

Edit: I was just stupid "a new protected member" error was for the function that was not actually overridden and just typed it as Protected was declared. Thanks for the Prague-Tip though!

The fact is that the protected members declared in an new class are slightly anxious Has been doing.

Hmm ... I can not reproduce it in plain test code:

  using the system; Public Square Base {Secure Virtual Zero} Fu () {}} Prepared Public Sealed Category: Base {Safe Override Zero Foo () {}}  

with warnings with .NET 3.5SP1 Compiled Are you overriding the Definitely base method? Check that you have actually received the override modifier (sorry, if it depends) - I'm not trying to accuse you of being free or anything. I'm just stumped otherwise ...)


Comments