Object-Oriented Programming

Encapsulation

English

Overview

The idea of hiding internal data and logic, exposing only the necessary interface to the outside.

Details

A design principle that restricts direct access to internal data, allowing manipulation only through a published interface, which hides implementation details. Exposing internal state through accessor methods like getters and setters means the internal implementation -- a field's type or how it's stored -- can later be changed without breaking any calling code.

More Programming terms