in reply to OO Getters/Setters
When you have an object, you need to send the object messages, that is, to activate the object's methods, rather than to access the object's attributes.
If you do have accessor methods, they are intended to control access by the class's methods, friends and subclasses, rather than for use in ordinary methods using the class. That is, the attributes are private, the accessors are protected
For example, a bank account class would need ( at least ) two attributed: balance and id number. The id number is set when the account is created and never changed after that. How the id number is read doesn't matter much, whether with an accessor or as a variable ... except that accessing the variable contains the risk of someone changing the number.
On the other hand, how you set the balance is more critical. In fact, you should never set the balance, you should deposit(amount) and withdraw(amount).
--
TTTATCGGTCGTTATATAGATGTTTGCA
|
---|