Can we use sealed class as a base class?


Base class is a class which can be overridden by other classes. Sealed class cannot be used as a base class because sealed class can not be overridden by any class.

Similarly, sealed class also cannot be used as an abstract class because abstract classes have one or more abstract methods which are implemented by derived classes.

One of the benefits of sealed classes is also because sealed classes can not be used as base classes, so CLR makes some runtime optimization on sealed classes. Creating objects and calling members of sealed class is faster. Learn more about why to use sealed class here.

Share this thread


comments powered by Disqus


Social Media