Ruby - Classes and Objects
What will be the output of this Ruby code?
class Person
attr_writer :age
def initialize(age)
@age = age
end
def show_age
@age
end
end
p = Person.new(30)
puts p.show_age
p.age = 40
puts p.show_age