Design advice – When to use “virtual” and “sealed” effectively [closed]

Start with the Microsoft Design Guidelines for Developing Class Libraries, particularly the Extensibility section, where you’ll find articles on virtual members and sealing.

Quoting, here:

  • Do not make members virtual unless you have a good reason to do so and you are aware of all the costs related to designing, testing, and maintaining virtual members.
  • Do prefer protected accessibility over public accessibility for virtual members. Public members should provide extensibility (if required) by calling into a protected virtual member.

  • Do not seal classes without having a good reason to do so.

  • Do not declare protected or virtual members on sealed types.
  • Consider sealing members that you override.

Read the full articles, though.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)