Top "Getter" questions

A getter is a public accessor method, used in object-oriented programming, which returns the value associated with a private member of a class.

Monitor All JavaScript Object Properties (magic getters and setters)

How do I emulate PHP-style __get() and __set() magic getter/setters in JavaScript? A lot of people say that this …

javascript node.js setter getter
Javascript getters/setters in IE?

For whatever reason, Javascript getters/setters for custom objects seem to work with any browser but IE. Does IE have …

javascript internet-explorer setter getter incompatibility
boolean properties starting with "is" does not work

I have a project that use JSF 2.1 and PrimeFaces. I tried to use a simple <h:outputText> referencing #{…

jsf-2 boolean javabeans el getter
Difference in C# between different getter styles

I do sometimes see abbreviations in properties for the getter. E.g. those two types: public int Number { get; } = 0 public …

c# getter shorthand coding-style
Can JS have getters and setters methods named same as property?

I want to achieve behaviour like down in code: function Foo(name) { this.name = name; }; var myFoo = new Foo('myName'); …

javascript setter getter
Why getter & setter if return value is mutable?

In C++ a getter & setter for a private data member is very useful due to the ability to control …

java getter-setter getter
JSR 303 Bean Validation - Why on getter and not setter?

I don't understand why JSR 303 (bean validation) is for the getter methods and not setter? Isn't it more logical to …

bean-validation getter
Allen Holub wrote "You should never use get/set functions", is he correct?

Allen Holub wrote the following, You can't have a program without some coupling. Nonetheless, you can minimize coupling considerably by …

language-agnostic oop immutability setter getter
initialize during declaration and create shorthand getter/setter

How do I initialize the member variables during declaration and create the getter/setter shorthand? Is it possible or do …

c# setter getter
Make a property that is read-only to the outside world, but my methods can still set

In JavaScript (ES5+), I'm trying to achieve the following scenario: An object (of which there will be many separate instances) …

javascript getter private-members defineproperty