Object relationships in software design — which construct implements a “Like a / Kind of” relationship?

Difficulty: Easy

Correct Answer: Inheritance

Explanation:

Introduction / Context:Design relationships can be summarized as “Is a/Kind of” for inheritance and “Has a” for composition/aggregation. Correctly mapping requirements to these helps create maintainable models.

Given Data / Assumptions:

  • We are distinguishing between ownership versus specialization relationships.

Concept / Approach:“Like a” or “Kind of” indicates specialization/generalization. A Square is a kind of Rectangle (inheritance). Composition instead expresses part–whole (a Car has an Engine).

Step-by-Step Solution:

Polymorphism → behavior substitution, not the relationship structure.Containership → ownership (“has a”), not “kind of”.Templates/generics → type parameterization, not a relationship.Encapsulation → information hiding, not relationship.Inheritance → specialization (“kind of”) → correct.

Verification / Alternative check:Class diagrams and Liskov Substitution Principle illustrate that a derived class is substitutable for its base — a hallmark of “kind of”.

Why Other Options Are Wrong:They represent orthogonal concepts or the wrong relationship type.

Common Pitfalls:Using inheritance where composition is more appropriate (leads to brittle designs).

Final Answer:Inheritance

More Questions from Inheritance

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion