Skip to content · ⁨본문 바로가기⁩

Encapsulation: private fields, getters, setters · ⁨은닉:private 필드, getter, setter⁩

English

Protect your data

  • Encapsulation means hiding an object's data and only changing it through methods.
  • This keeps the data safe. Other code cannot put a bad value into it.
  • The main tools are the words private and public.

한국어

데이터 보호

  • Encapsulation은 객체의 데이터를 숨기고 메서드를 통해만 변경하도록 하는 것입니다.
  • 이를 통해 데이터를 안전하게 유지하며, 다른 코드에서 잘못된 값을 넣을 수 없습니다.
  • 주요 도구로 사용되는 단어는 private와 public입니다.

private Balance 필드는 getBalance과 setBalance를 통해서만 접근할 수 있습니다

Handout · ⁨교재 자료⁩

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP