Difficulty: Easy
Correct Answer: A class that has no direct instances, but whose descendants may have direct instances.
Explanation:
Introduction / Context:An abstract class is a core concept in object oriented programming used to define a common contract and shared behavior while preventing direct instantiation. It serves as a template for subclasses that implement or specialize the abstract behavior.
Given Data / Assumptions:
Concept / Approach:By definition, an abstract class cannot be instantiated directly. Instead, its concrete subclasses are responsible for providing implementations of abstract members and then can be instantiated. This enforces a design where common structure is centralized, but variability is left to descendants.
Step-by-Step Solution:
Identify that direct instantiation of an abstract type is not allowed by the compiler or runtime.Recognize that subclasses supply concrete implementations where required.Therefore, only descendants can have direct instances while the abstract parent cannot.Verification / Alternative check:Attempting to instantiate an abstract class in mainstream languages leads to compile time errors, confirming the rule.
Why Other Options Are Wrong:
Common Pitfalls:Confusing abstract classes with interfaces; declaring a class abstract without a clear need; overusing inheritance instead of composition when behavior sharing is minimal.
Final Answer:A class that has no direct instances, but whose descendants may have direct instances.
Discussion & Comments