Created
February 26, 2013 16:41
-
-
Save leoallen85/5039963 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 Person | |
# attr_reader :height | |
def initialize(height) | |
@height = height | |
end | |
def speak | |
puts "My height is #{@height}" | |
end | |
def run | |
puts "Im running" | |
end | |
end | |
class Man < Person | |
def speak(another_string = nil) | |
puts "hur hur hur my height is #{@height}" | |
if another_string | |
puts another_string | |
end | |
end | |
end | |
class FrenchMan < Man | |
def speak | |
puts "mon height, c'est #{@height}" | |
super | |
end | |
end | |
pierre = FrenchMan.new(200) | |
pierre.speak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment