class Person
attr_reader :name
attr_reader :job
attr_writer :job
def initialize(name, job)
@name = name
@job = job
end
end
client = Person.new("Jim", "programmer")
puts "#{client.name} is a #{client.job}"
client.job = "dentist"
puts "#{client.name} is a #{client.job}"
No comments:
Post a Comment