What are sealed modifiers?

Asked 07-Dec-2019
Viewed 909 times

1 Answer


What are sealed modifiers?

The sealed classes are used to restrict the users from inheriting the class. Any class can be sealed by using the sealed keyword.When we use the sealed keyword with a method or class as an access modifier, the keyword tells the compiler that it is a method or class seal, and therefore, cannot be extended. No any class can be derived from a sealed class.

Whenever we will use sealed keyword (modifiers) in C# on a method, then that method loses their capabilities of overriding. That is the sealed method should be part of a derived class and the method must be an overridden method.
What are sealed modifiers?