Pavan Ramamurthy
Which class that cannot be inherited
By Pavan Ramamurthy in C# on Aug 21 2013
  • Hitanshi Mehta
    Sep, 2018 28

    Classes which are marked as sealed at time of definition can not be inherited.

    • 0
  • Kuntal Patra
    Sep, 2013 15

    Sealed class

    • 0
  • ponveni
    Sep, 2013 12

    Sealed classes cannot be inherited. Class that are marked with the sealed (C#) or NotInheritable (VB.NET) keywords cannot be inherited from. This is done at the definition of the classes.The most commonly used sealed class is System.String. Abstract and Sealed Classes and Class Members (C# Programming Guide): public sealed class D { // Class members here. }A sealed class cannot be used as a base class. For this reason, it cannot also be an abstract class. Sealed classes prevent derivation. Because they can never be used as a base class, some run-time optimizations can make calling sealed class members slightly faster. MustInherit and NotInheritable Classes: NotInheritable Class A End Class Class B ' Error, a class cannot derive from a NotInheritable class. Inherits A End ClassA NotInheritable class is a class from which another class cannot be derived. NotInheritable classes are primarily used to prevent unintended derivation. In this example, class B is in error because it attempts to derive from the NotInheritable class A. A class can not be marked both MustInherit and NotInheritable.

    • 0
  • Pavan Ramamurthy
    Aug, 2013 21

    Sealed Class

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS