WHAT IS SEALED CLASS?

yash Singh

Total Post:0

Points:0
Posted by  yash Singh
OOPS 
 2698  View(s)
Ratings:
Rate this:
  1. yash Singh

    Post:3

    Points:15
    What is sealed class?

    What is sealed class?

  1. Mahesh Rawat

    Post:138

    Points:690
    What is sealed class?

    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.

      Modified On Mar-26-2018 06:07:14 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!