What is an abstraction in object-oriented programming?

Options

  • A. Hiding the important data
  • B. Hiding the implementation
  • C. Hiding the implementation and showing only the features
  • D. Showing the important data

Correct Answer (Detailed Explanation is Below)

C. Hiding the implementation and showing only the features

Detailed Explanation

Explanation:

Abstraction in Object-Oriented Programming means:

Showing only the essential features of an object and hiding the internal implementation details.

For example, when you drive a car:

  • You use the steering wheel, brake, and accelerator (features).

  • You don’t need to know how the engine works internally (implementation hidden).

In C++ and Java, abstraction is achieved using:

  • Abstract classes

  • Interfaces

OOps! You are currently offline.