えいたんごクイズ

getter

/ˈɡɛtɚ/
暗記モードで復習 →

noun

ゲッター

解説 Definition

getterはオブジェクト指向プログラミングで、オブジェクトが持つプロパティの値を外部から取得するためのメソッド(または関数)です。通常、プロパティへの直接アクセスを避けながら値を読み出すために使われ、内部データの管理を容易にします。カプセル化されたクラスでは、getterを通じて必要な値だけを公開する設計になります。

A getter is a person or thing that gets, brings, or obtains something. The word is not very common by itself and often appears as part of a longer expression.

覚え方のコツ Memory Tip

getter はまず超基本動詞 get「手に入れる・取る」が見えれば覚えやすいです。そこに「〜するもの」の -er が付いて、「取ってくるもの」と考えると、プロパティの値を外から取り出す役割に直結します。プログラミングでは setter と対で覚えるのが最重要で、getter は読む、setter は書く、という対応で整理すると混乱しません。文脈は get the value, get a property ではなく、Java などでは call the getter, getter method が頻出です。

A getter is the thing that gets a value. The easiest memory pair is getter and setter: getter reads, setter writes. If you see it with words like property, method, or value, think of code that lets you access data.

例文

The getter function retrieves the value of the private variable.

取得関数はプライベート変数の値を取得します。

In JavaScript, getters provide a way to access object properties.

JavaScriptでは、取得関数はオブジェクトプロパティにアクセスする方法を提供します。

The class defines a getter for the user's email address.

クラスはユーザーのメールアドレスの取得関数を定義します。

getter の類義語・関連語

getter の語源・成り立ち Etymology

getter は get+行為者を表す接尾辞 -er で、字義どおり「取る人・得るもの」です。get は古ノルド語 geta「得る・生じさせる」に由来するゲルマン系の語で、「手に入れる」が核なので、programming の getter も「値を取ってくるもの」と納得できます。関連語は get, beget です。

Getter comes from get plus the agent suffix -er, so it first meant "one that gets." Get entered English from Old Norse geta, meaning "obtain" or "reach," and it kept the core idea of gaining or bringing something. That is why even in computing, a getter is something that "gets" a value. Related words include get and beget.

外部辞書で調べる

この単語をシェア

この単語を英単語クイズで覚えよう