= first_name @last_name = last_name end end class Male < Person def full_name first_name + " " + last_name end def gender "M" end end 使⽤用前 class Female < Person def full_name first_name + " " + last_name end def gender "F" end end
= first_name @last_name = last_name end def full_name first_name + " " + last_name end end class MalePerson < Person def gender "M" end end 使⽤用後 class FemalePerson < Person def gender "F" end end