Created
May 5, 2015 20:47
-
-
Save Harvnlenny/799f9ec4744dd705e999 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize(name) | |
@name = name | |
end | |
def say_hi | |
"Hi!" | |
end | |
def say_name | |
"My name is #{@name}" | |
end | |
end | |
martin = Robot.new("Martin") | |
puts martin.say_hi | |
puts martin.say_name | |
class Droids < Robot | |
def say_name | |
"Who dares to disturb #{@name}?" | |
end | |
end | |
fuzzbot = Droids.new("fuzzbot") | |
puts fuzzbot.say_hi | |
puts fuzzbot.say_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/799f9ec4744dd705e999.git
@ambethia thank you for the help today!