Top "Getter-setter" questions

Public mutator methods in object-oriented programming, responsible for changing and returning the value of private class members, thus keeping with the principle of encapsulation.

How can I overwrite a getter method in an ActiveRecord model?

I'm trying to overwrite a getter method for an ActiveRecord model. I have an attribute called name in the model …

ruby-on-rails ruby rails-activerecord getter-setter
Custom Getter & Setter iOS 5

I want to override the getter and setter in my ObjC class using ARC. .h File @property (retain, nonatomic) Season *…

objective-c ios automatic-ref-counting getter-setter
How to write C++ getters and setters

If I need to write a setter and/or getter for a property I write it like this: struct X { /*...*/}; …

c++ getter-setter
How to write a getter and setter for a Dictionary?

How do you define a getter and setter for complex data types such as a dictionary? public Dictionary<string, …

c# dictionary getter-setter
Should I use public or private variables?

I am doing a large project for the first time. I have lots of classes and some of them have …

c++ oop abstraction getter-setter data-access
Why doesn't JAXB generate setters for Lists

When I generate JAXB classes from an XSD, the elements with maxOccurs="unbounded" gets a getter method generated for them, …

java jaxb getter-setter
C# getter and setter shorthand

If my understanding of the internal workings of this line is correct: public int MyInt { get; set; } Then it behind …

c# getter-setter shorthand
Is it good practice to make getters and setters inline?

public: inline int GetValue() const { return m_nValue; } inline void SetValue(int nNewValue) { this -> m_nValue = nNewValue; } On …

c++ performance inline getter-setter
Immutable Object with ArrayList member variable - why can this variable be changed?

I have got one class with various member variables. There is a constructor and there are getter-methods, but no setter-methods. …

java object immutability member getter-setter
How do you implement a private setter when using an interface?

I've created an interface with some properties. If the interface didn't exist all properties of the class object would be …

c# asp.net interface getter-setter