Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is a sealed class used for in c#?

user-image
Question added by Deleted user
Date Posted: 2016/04/05
Syed Abbas
by Syed Abbas , It Analyst , Tata consultancy services

In simple terms, Sealed class is used in c# to avoid other classes to inherit your class. Some points to remember when working with Sealed Classes

  • Sealed class cannot be a base class
  • Sealed class can be a derived class
  • Sealed class cannot be an abstract class because it has to implement the abstract methods in the derived class which we are restricting here.

 

In addition to your question you can even seal your methods in a non-sealed class. This is used to define the overriding level of a virtual method.Sealed keyword in methods is always used with Override keyword.

 

Hope this helps.

 

 

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.