Why use sealed class in C#? Explain a business case.

Solution

We use sealed class when we want to prevent inheritance of a class, we do not want to allow some class to extend the functionality of a class. 

Generally, we create sealed classes for those classes which implement security features which can be overridden by other classes if it is not in sealed class.

 

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media