Skip to content

Instantly share code, notes, and snippets.

@m0wfo
Created December 27, 2008 15:57
Show Gist options
  • Save m0wfo/40266 to your computer and use it in GitHub Desktop.
Save m0wfo/40266 to your computer and use it in GitHub Desktop.
class Account
def initialize(balance)
@balance = balance
end
def transfer_money(to,amount)
p "Sender now has #{balance - amount}"
p "Recipient now has #{to.balance + amount}"
end
protected
def balance
@balance
end
end
chris = Account.new(100)
osama = Account.new(150)
chris.transfer_money(osama, 25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment