Created
December 27, 2008 15:57
-
-
Save m0wfo/40266 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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