First page Back Continue Last page Graphics
Accessor Methods
Accessor methods are used to interact with Object Attributes. One can set or get the values on the Object.
You should always use any provided accessor methods when manipulating another object's attributes. Never reach into an object and change values directly.
As per Cocoa naming convention Setter methods are named after the attribute they change, preceded by the world “set”. Example setAge, setName setFillColor
Getter names are simply named after the attribute they return. For example for above setters getter methods will be age,name,fillColor.
Preceding get with attribute name will actually violate Cocoa naming conventions.