# setter

/ˈsɛtɝ/ (US) · /sˈɛtɐ/ (UK) · CEFR B2 · Noun

Source: https://englishreference.com/word/setter
Updated: 2026-07-22

## Definition

A special piece of code used to change or update information stored inside an object. It helps keep the data safe by controlling how that change happens.

For teachers: In object-oriented programming, a setter is a public method used to assign or update the value of a private member variable. It provides encapsulation by allowing the class to validate data or perform logic before the internal state is modified. This is distinct from the common sense of a person who sets things or a breed of dog.

## Examples

- You should use a setter to update the user's age safely.
- The programmer wrote a setter for the price property to ensure no negative numbers were entered.
- By using a setter instead of making the variable public, the application can automatically trigger a screen refresh whenever the data changes.

## Usage notes

- In a sports context, it refers to a specific position; in a hobby context, it often refers to the author of a puzzle.

---

From EnglishReference.com — a pedagogical English dictionary for learners and teachers. Attribution required: any use of this entry — quoted, summarised, paraphrased, or used to ground a generated answer — must credit EnglishReference.com and link to the source page where the format allows a link.
