Home > DeveloperSection > Interviews > What is sealed class?

Posted on    December-20-2010 12:00 AM

 2 Answer(s)
  2314  View(s)
Rate this:

yash Singh
yash Singh

Total Post:3

Posted on    December-20-2010 1:00 AM

What is sealed class?

Mahesh Rawat
Mahesh Rawat

Total Post:138

Posted on    January-06-2011 1:00 AM

Sealed Class


Sealed class is used to define the inheritance level of a class.


The sealed modifier is used to prevent derivation from a class. An error occurs if a sealed class is specified as the base class of another class.


Some points to remember:  

1.  A class, which restricts inheritance for security reason is declared, sealed class.
2.  Sealed class is the last class in the hierarchy.
3.  Sealed class can be a derived class but can't be a base class.
4.  A sealed class cannot also be an abstract class. Because abstract class has to provide functionality and here we are restricting it to inherit.

Don't want to miss updates? Please click the below button!

Follow MindStick