Last active
August 29, 2015 14:01
-
-
Save amckemie/1ac66414e7857c964465 to your computer and use it in GitHub Desktop.
Basic Banking Set Up
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 Person | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
end | |
class Bank | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
@accounts = [] | |
end | |
def open_account(person) | |
@accounts << person.name | |
puts "#{person.name} created an account at #{@name}" | |
end | |
end | |
person1 = Person.new("Chase") | |
chase = Bank.new("Chase Bank") | |
chase.open_account(person1) | |
# This last line should puts "Chase opened an account at Chase Bank" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment