can we have protected members in the sealed class?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • puzzlecracker

    #1

    can we have protected members in the sealed class?

    I see the "Warning new protected member declared in sealed class",
    and I understand that it makes no sense to have. I wonder why it's not
    prohibited altogether.
  • Anthony Jones

    #2
    Re: can we have protected members in the sealed class?

    "puzzlecrac ker" <ironsel2000@gm ail.comwrote in message
    news:a5fc9963-cc60-4fd1-9f3a-b0b6863d5470@z6 6g2000hsc.googl egroups.com...
    I see the "Warning new protected member declared in sealed class",
    and I understand that it makes no sense to have. I wonder why it's not
    prohibited altogether.
    Because it doesn't actually break anything.

    --
    Anthony Jones - MVP ASP/ASP.NET

    Comment

    • =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?=

      #3
      RE: can we have protected members in the sealed class?

      It makes it easier to change the class to and from sealed. There if no need
      to prevent it. It warns you because there is a chance you have made a mistake
      as you appear to intend in one place to have your class inherited from and in
      another to prevent it.

      --
      Ciaran O''Donnell



      "puzzlecrac ker" wrote:
      I see the "Warning new protected member declared in sealed class",
      and I understand that it makes no sense to have. I wonder why it's not
      prohibited altogether.
      >

      Comment

      Working...