🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Encapsulation

In plain terms

Bundling data with the code that operates on it, and hiding the internals.

Going deeper

In object-oriented design, an object keeps its state private and exposes only safe methods to change it. This protects data from invalid changes and lets you alter internals without breaking the rest of the program.

Under the hood

Enforced via access modifiers (private/protected/public); good encapsulation exposes intent through methods and hides invariants, enabling safe refactoring of internals.

Examples

A BankAccount with private balance and deposit()/withdraw() methods; getters/setters.

Think of it like...

Like a vending machine: you press buttons and insert coins (the public interface), but you can't reach inside and rearrange the wiring.

Feedback & Bug Report