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 do I spyOn Typescript getters and setters?

When I unit test my getters are setters for Typescript, I cannot find a way to spy on those getters …

typescript jasmine getter-setter
input and output for the same variable

I have a variable that can be edited from parent and for child. parent.html: <div *ngIf="editEnabled"> &…

angular angular5 getter-setter
Python: multiple properties, one setter/getter

Consider the following class definitions class of2010(object): def __init__(self): self._a = 1 self._b = 2 self._c = 3 def set_a(…

python properties setter getter-setter
How to implement BehaviorSubject with getter and setter in Angular 2

I'm trying to implement in my LoginService a isLoggedIn boolean value of type BehaviorSubject together with getter and setter functions …

angular typescript getter-setter tslint behaviorsubject
Why return $this in setter methods?

Examining Zend Framework, I found that all setter methods (of those I’ve examined) return the instance of the class …

php zend-framework return getter-setter
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
Java: Getter and setter faster than direct access?

I tested the performance of a Java ray tracer I'm writing on with VisualVM 1.3.7 on my Linux Netbook. I measured …

java performance getter-setter
Calculating distance between two points in 3D

My assignment is to create main class in which I initialize the value of any point to be at (0,0,0) and …

java distance getter-setter coordinate euclidean-distance
JavaWorld on OO: Getters/Setters vs Builder

Background: I found this article on JavaWorld, where Allen Holub explains an alternative to Getters/Setters that maintains the principle …

java oop design-patterns builder getter-setter
setter and getter for an atomic property

what's the auto-gen'd getter and setter look like for the following property value? ... in .h @interface MyClass : NSObject { @private NSString *_…

objective-c properties atomic getter-setter