What are sealed modifiers?

0 votes
242 views
Shikhar Arora asked 07-Dec-2019 in Technology by Shikhar Arora

What are sealed modifiers

1 Answer

0 votes
Rahul Roi answered 09-Dec-2020 by Rahul Roi

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?