How to use Sealed classes in the c# program?
1721
14-Sep-2016
Barbara Jones
14-Sep-2016If we use Sealed classes in the program, then we can't inherit it.
In C#, the sealed modifier is used to define a class as sealed.
Below are two examples where we can use sealed key word for the class :
1st example
Below program will run successfully even after using the sealed keyword.
2nd example :
Below program will not run as Test class is sealed which cannot be inherit.