What are Sealed Classes in C#?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are predicates in c#?

546


Is as operator in c#?

473


Is dictionary a collection?

474


List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.

526


Is datetime nullable c#?

508






Is array value type in c#?

592


Is c# scripting language?

507


What exactly happens when we debug and build the program?

2177


What language is c# similar to?

488


Why should I use interface in c#?

499


If you want to write your own dot net language, what steps you will u take care?

563


What is the difference while using directive vs using statement ?

524


Which operator cannot be overloaded in c sharp?

495


Is 0 an unsigned integer?

499


What are the delegates in c#?

480