Next | 1.0 Classes | Prev |
Ruby comes with the large pre-defined class hierarchy.
class Person attr :name attr :email def initialize(name, email='no@email.org') @name = name @email = email end end monger = Person.new("Mr. Hacker", "mr@hacker.org") p monger.name
"Mr. Hacker"
Next | Ruby for Perl programmers | Prev |