Difficulty: Easy
Correct Answer: Polymorphism
Explanation:
Introduction / Context:Object-oriented programming promotes code reuse and flexibility through encapsulation, inheritance, and polymorphism. When a common operation name is implemented differently across classes yet invoked uniformly, we are using polymorphism.
Given Data / Assumptions:
Concept / Approach:Polymorphism literally means “many forms.” Through interface or superclass references, the same operation name results in class-specific behavior. This is foundational for extensible designs and polymorphic collections.
Step-by-Step Solution:
Compare definitions: inheritance (is-a relationship), encapsulation (information hiding), polymorphism (many forms).Map the described behavior to polymorphism.Confirm: the same message produces different effects depending on the receiver’s class.Verification / Alternative check:Example: List.toString() behaves differently for ArrayList and LinkedList but can be invoked via a List reference.
Why Other Options Are Wrong:Inheritance defines type hierarchy, not behavior resolution itself. Encapsulation hides internal state/implementation. Multiple classification is not a standard OO pillar in this context.
Common Pitfalls:Confusing overloading (same method name, different parameter lists) with overriding (same signature, different classes). Both are forms of polymorphism but operate at different binding times.
Final Answer:Polymorphism
Discussion & Comments