class Person
attr_reader :name
attr_accessor :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