ruby入門_ツールバーの
class Person
def initialize name,age,sex
@name = name
@age = age
@sex = sex
end
# read
attr_reader :name
# write
attr_writer :age
# read and write
attr_accessor :sex
end
tom = Person.new "Tom",20,"male"
puts tom.name
tom.age = 20
tom.sex = "female"
puts tom.sex