in reply to Re^3: OOP's setter/getter method - is there a way to avoid them?
in thread OOP's setter/getter method - is there a way to avoid them?
Using the bank account example, though, what if I just want to check my balance? What if I just want to check the date of account creation, or verify my account number? No actual mutation is necessary, but it would be handy to access those values. There wouldn't be a need to mutate those directly, but accessing them without making a deposit or withdrawal should be possible. I suppose you could have a method called query_balance that returns the balance and also updates a log of the query.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: OOP's setter/getter method - is there a way to avoid them?
by BrowserUk (Patriarch) on Nov 05, 2015 at 15:27 UTC |
In Section
Seekers of Perl Wisdom