What is abstraction in OOP?easy

Type
conceptual
Topic
abstraction
Frequency
common
Tags
abstraction
Answer

Abstraction hides implementation complexity and exposes only what a caller needs to use an object. Abstract classes and interfaces define contracts without specifying how they are fulfilled.

Explanation

A DatabaseConnection abstraction exposes connect() , query() , close() - callers do not need to know whether it connects to PostgreSQL or MySQL. Good abstraction reduces cognitive load and makes units independently testable by swapping implementations.

Follow-upHow does abstraction relate to the dependency inversion principle?