What are sealed classes in C#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

What are sealed classes in C#?

20th May 2018, 7:54 AM
Prabhat
Prabhat - avatar
8 Answers
+ 5
Sealed classes are used to restrict the inheritance feature ofobject oriented programming. Once a class is defined as a sealed class, the class cannot be inherited. In C#, the sealed modifier is used to define a class as sealed. In Visual Basic .NET the NotInheritable keyword serves the purpose of sealed csharp.net
20th May 2018, 7:58 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 8
Brains, is it correct that -Sealed modifier used to prevent derivation from a class ?
20th May 2018, 8:01 AM
Prabhat
Prabhat - avatar
+ 3
Sealed keyword is used to prevent a class from inheriting. It can also be used to prevent a member of a class such as method, also known as behavior, from overriding
20th May 2018, 8:12 AM
Kimhor
Kimhor - avatar
+ 3
sealed keyword is used to prevent other classes to inherite it
21st May 2018, 12:31 PM
Vishwanath Patil
Vishwanath Patil - avatar
+ 3
sealed class will prevent the class from inheriting. It can be also used in method overriding to prevent overridding by the derived class.
1st Jun 2018, 8:15 PM
Rencil Justin Evangelista
Rencil Justin Evangelista - avatar
+ 2
Sealed is a type of modifier that restricts inheritance. Similar how final is a constant and private restricts interface of the client from directly accessing data without a method.
21st May 2018, 4:58 PM
Apple Blossom
Apple Blossom - avatar
+ 1
Sealed is a keyword which uses in the class or method for not to inherit by the other class
7th Jun 2018, 10:21 AM
ashfaq shaikh
ashfaq shaikh - avatar
+ 1
sealed is a keyword used in c# inorder to prevent inheritance which is a key feature of object oriented programming language
20th Oct 2018, 12:59 AM
@ramis