Bird
Raised Fist0

Why can't an abstract class in C# be sealed at the same time?

hard🧠 Conceptual Q10 of Q15
C Sharp (C#) - Polymorphism and Abstract Classes
Why can't an abstract class in C# be sealed at the same time?
ABecause abstract classes are always static, sealed classes cannot be static.
BBecause sealed classes cannot be inherited, but abstract classes require inheritance.
CBecause sealed classes must have all methods implemented, abstract classes do not.
DBecause sealed classes cannot contain abstract methods.
Step-by-Step Solution
Solution:
  1. Step 1: Understand sealed and abstract class roles

    Sealed classes prevent inheritance; abstract classes require inheritance to implement abstract members.
  2. Step 2: Analyze incompatibility

    Combining sealed and abstract is contradictory because abstract classes must be inherited.
  3. Final Answer:

    Because sealed classes cannot be inherited, but abstract classes require inheritance. -> Option B
  4. Quick Check:

    Sealed blocks inheritance; abstract needs inheritance [OK]
Quick Trick: Sealed blocks inheritance; abstract needs it [OK]
Common Mistakes:
MISTAKES
  • Thinking sealed classes can be abstract
  • Confusing static with sealed or abstract
  • Believing sealed classes can have abstract methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes