What are Sealed Classes in C#?
Answers were Sorted based on User's Feedback
Answer / aseem
If it restricts inheritance then why dont we create a
normal class. why do we require this seamled class to
inherit? can any one show with example?
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / rishu
Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as sealed class, this class cannot be inherited.
In C#, the sealed modifier is used to define a class as sealed. In Visual Basic .NET, NotInheritable keyword serves the purpose of sealed. If a class is derived from a sealed class, compiler throws an error.
If you have ever noticed, structs are sealed. You cannot derive a class from a struct.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / haja
Hello Guys this is Haja,
I think the question is "What are sealed classes in C#?"
not "WHAT IS SEALED CLASS IN C#?"
The answer is "Every attribute classes are sealed class like [WebMethod], [STAThread], [Serializable] and like these attribute classes...
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / atul dhivar
sealedclasses cannot be extended,but they can inherit from
other classes
| Is This Answer Correct ? | 2 Yes | 3 No |
Answer / alex
sealed class used for a security purpose without using sealed class , the class must be inherited,
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / sanjay
sealed classes can only be used as a base classes,they cant
be inherited.
| Is This Answer Correct ? | 23 Yes | 27 No |
Answer / susheel kumar
sealed classes used only base class do not used derived class
| Is This Answer Correct ? | 20 Yes | 32 No |
How do you specify a custom attribute for the entire assembly (rather than for a class)?
How to handle exceptions that are raised in a component?
Can dictionary have duplicate keys c#?
can we declare a variable by name "this" in a class? Please explain?
Explain about generics in c#.net?
What Are The .Net Object
What are strongly typed objects?
What is the difference between dynamic and var in c#?
Explain the difference between access specifier and access modifier in c#?
What is the process of delegation?
What is difference between abstraction and encapsulation in c#?
Is dictionary a collection?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)