Skip to content

Instantly share code, notes, and snippets.

@leoallen85
Created February 26, 2013 16:41
Show Gist options
  • Save leoallen85/5039963 to your computer and use it in GitHub Desktop.
Save leoallen85/5039963 to your computer and use it in GitHub Desktop.
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