difference between static and sealed class

Asked 13-Nov-2017
Viewed 1767 times

1 Answer


0

Difference between Static class and sealed class:
Static class:
1) static class is those class that can’t be instantiated. Means you can't create the instance of any static class.
2) static class can only contain static members or function.
3) Static classes can only have a static constructor to initialize static members function.
4) Static classes are sealed so they can’t be inherited.
6) static class is defined using “static’ keyword.
Example -        static class class_name

Sealed Class:
1) Sealed Class can’t be inherited means When you define any class as sealed class it’s not possible to inherit that class.
2) In Inheritance feature sealed class is the last class.
3) You can’t define an abstract method or abstract class in sealed classes.
4) The sealed class is defined using “sealed’ keyword.
Example-    sealed class class_name