in reply to What is the use of getter and setter
For example, instead of doing
$obj->{key} = 'val';
you'd do
$obj->key('val');
The latter might simply do the same thing as the former. Or maybe it adds error checking. At the very least, it gives the *option* to add error checking without breaking code.
|
|---|