标签:
class Language
def initialize(name, creator)
@name = name
@creator = creator
end
def description
puts "I‘m #{@name} and I was created by #{@creator}!"
end
end
ruby = Language.new("Ruby", "Yukihiro Matsumoto")
python = Language.new("Python", "Guido van Rossum")
javascript = Language.new("JavaScript", "Brendan Eich")
ruby.description
python.description
javascript.description
标签:
原文地址:http://www.cnblogs.com/patientAndPersist/p/4378321.html