Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (24 sloc) 0.551 kB
# ================================
# Inheritance
#
# classes can inherit values and
# behavior from another class. this
# is one of the primary strengths
# of object oriented programming.
# ================================
# ================================
# simple inheritance
# ================================
class Animal # Animals can move
def move
puts "moving..."
end
end
class Bird < Animal # a Bird is an animal
def fly
puts "flying..."
end
end
roy = Bird.new # Birds can move and fly
roy.move
roy.fly
Jump to Line
Something went wrong with that request. Please try again.