Skip to content

Instantly share code, notes, and snippets.

@amckemie
Last active August 29, 2015 14:01
Show Gist options
  • Save amckemie/1ac66414e7857c964465 to your computer and use it in GitHub Desktop.
Save amckemie/1ac66414e7857c964465 to your computer and use it in GitHub Desktop.
Basic Banking Set Up
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