Encapsulation
Hide data behind `private`/`protected` and expose a minimal `public` interface.
Beginner
Class invariants (e.g. "speed ≤ max") can only be guaranteed if fields aren't freely writable.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.