I am trying to wrap my head around the use of private methods, since it seems too easy to compromise un-encrypted information from private methods. I know the challenge was to access the pin from outside the class, but what is to keep someone from just monkey patching to get at the private methods? If not for banking, what would be a good real-world use for private methods? Or am I missing something?
I added the following underneath my class declaration:
class Account def hack() puts pin() end end checking_account = Account.new('Test', 98_000_000_000) checking_account.hack()
When I run it I get: