Sealed modifiers in Object Oriented Programming

What are Sealed modifiers in OOPS?What are the advantages if we use sealed modifiers?


3 Answers
1-3 of  3
3 Answers
  • When applied to a class, the sealed modifier prevents other classes from inheriting from it. In the following example, class B inherits from class A , but no class can inherit from class B . You can also use the sealed modifier on a method or property that overrides a virtual method or property in a base class.

  • Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as a sealed class, the class cannot be inherited. The "sealed" modifier is used to define a class as sealed. Sometimes classes are too precious and not designed to be inherited.

Oops

Didn't get the answer.
Contact people of Talent-Oops directly by clicking here