If any method of a class is sealed, does it mean, class is also sealed? How is it different than abstract class?

Answer: No, in any class if we have sealed method it does not mean that the class is sealed. This rule is only apply to an abstract class that if any class have at least one abstract method, the class becomes an abstract class.

Differences: Sealed and Abstract class

  • We cannot create object of an abstract class but we can create object of a sealed class.
  • Abstract method does not have any implementation, but sealed method have implementation.
  • Sealed class cannot be a base class as no class can extend it but abstract method can be a base class and other classes can extend it.

Related Posts