Which OOP concept focuses on hiding internal implementation details and…
2024
Which OOP concept focuses on hiding internal implementation details and exposing only the necessary functionality to the user?
Answer: B. Abstraction — ConceptIn object-oriented programming, the principle of exposing only the essential, relevant behaviour of an object to its user — while deliberately hiding…
- A.
Inheritance
- B.
Abstraction
- C.
Encapsulation
- D.
Polymorphism
- E.
Overloading
Attempted by 19 students.
Show answer & explanation
Correct answer: B
Concept
In object-oriented programming, the principle of exposing only the essential, relevant behaviour of an object to its user — while deliberately hiding the internal implementation details of HOW that behaviour is realised — is a core design idea. It answers "what does this do" and conceals "how it is done", typically realised through abstract classes and interfaces that publish a contract without revealing the underlying code. This principle is called Abstraction.
Application to this question
The stem describes exactly this: "hiding internal implementation details" and "exposing only the necessary functionality to the user". A user of an abstract type calls its published methods without needing to know the algorithm, data layout, or any internal logic behind them. That separation of the visible interface from the hidden implementation is the definition of Abstraction.
Contrast with the other concepts
Encapsulation — bundles data with the methods that operate on it and restricts direct access to that internal state (e.g. private fields with public getters/setters). It is about protecting and controlling access to data, not about presenting a simplified view of behaviour; the stem speaks of hiding implementation and exposing functionality, not access control.
Inheritance — lets a class acquire the properties and behaviour of a parent class to enable reuse and an "is-a" hierarchy; it has nothing to do with hiding implementation.
Polymorphism — lets one interface or method name behave differently for different underlying types (one name, many forms); it is about varying behaviour, not concealing it.
Overloading — defining several methods with the same name but different parameter lists; it is a specific compile-time mechanism, not a core abstraction principle.