Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >> class Person
- >> def age
- >> self.calculate_age
- >> end
- >>
- ?> def calculate_age
- >> 'age from person'
- >> end
- >> end
- => nil
- >>
- ?> class Joe < Person
- >> def calculate_age
- >> 'age of Joe'
- >> end
- >> end
- => nil
- >> j = Joe.new
- => #<Joe:0x257a9c>
- >> j.age
- => "age of Joe"
- >> p = Person.new
- => #<Person:0x252b14>
- >> p.calculate_age
- => "age from person"
- >>
Add Comment
Please, Sign In to add comment