Wednesday, September 2, 2020

Sealed Classes and Members

  • If "sealed" modifier applied to a class, prevents derivation from that class.
  • If "sealed" modifier applied to a method, prevents overriding of that method in a derived class.  
  • Sealed classes are slightly faster because of some run time optimization.  But sealed classes are hardly ever used. 
  • The string class is declared as sealed, and that’s why we cannot inherit from it


No comments:

Post a Comment