Another way to super

class Creature
def initialize name, hp
@name, @hp = name, hp
end
end

class Hostile < Creature
def initialize name, hp, ap
super name, hp
@ap = ap
end
end

About AJ

In the future, he hopes that this blogsite will be humorous, informative, and enjoyable for the visitors.
This entry was posted in Ruby and tagged . Bookmark the permalink.

One Response to Another way to super

  1. My favorite language is Python, but that lack of parentheses and self variables is beautiful.
    Speaking of beauty, see http://codex.wordpress.org/Writing_Code_in_Your_Posts

Comments are closed.