Index
Setter Concept


A setter has a simple single purpose which is to assign the passed param value to the associated ivar.

The associated ivar is determined like generally like this:

setter: setXXXX
ivar: XXXX

And specifically for our example:

setter: setWidth
ivar: width


Setters (Accessors)


Setter accessors set data (ivar value) into the given object. They do not return a value.

These examples are in JavaScript, but the idea is the same in any object language.

Setter for ivar "width"
setWidth(newWidth) {
	this.width = newWidth;
}
Setter for ivar "height"
setHeight(newHeight) {
	this.height = newHeight;
}