Getter: meaning, definitions and examples

๐Ÿ”
Add to dictionary

getter

 

[ หˆษกษ›tษ™r ]

Noun
Context #1 | Noun

programming term

A getter is a method that is used to obtain the value of a private field in a class. In object-oriented programming, getters are part of the encapsulation principle, allowing controlled access to an object's attributes.

Synonyms

accessor, retrieve

Examples of usage

  • The class uses a getter to return the value.
  • You should call the getter to retrieve the private variable.
  • Using a getter improves data encapsulation.

Word origin

The term 'getter' is derived from the verb 'get', which originates from the Old Norse word 'geta', meaning 'to obtain, reach, or perceive'. The use of 'getter' in programming began to popularize in the late 20th century, especially with the rise of object-oriented programming languages like Java and C++. The practice of using getters and setters is linked to the encapsulation concept, which promotes the idea of restricting direct access to an object's data and providing methods for controlled interaction. This helps maintain the integrity of the data and the internal state of objects.

Word Frequency Rank

At rank #27,461, this word represents specialized academic or technical vocabulary. It's less frequently encountered but may be valuable in specific contexts.