2011-09-03

super in Ruby

<code>

class Person

def initialize(name)

@name = name

end


def name

return @name

end

end


class Doctor < Person

def name

“Dr. “ + super

end

end

</code>


That, in short, is how super works. 

1 Comments:

Blogger Alex Dissing said...

Interesting. I'm a stutterer guy practicing my writing. http://alexdissing.blogspot.com/

Thursday, September 29, 2011 at 2:29:00 PM PDT  

Post a Comment

<< Home

Google
 
Web luminus529.blogspot.com