Chapter 6 Inheritance
Inheritance permits you to create a class that is a specialization of another class. Classes lower down the hierarchy can inherit the features and functionalities of those higher up. Also, lower classes can add features of their own.
Ruby offers simple single inheritance. A single inheritance implementation permits a Ruby class to have one direct parent or class.
Example:
class Bird
def fly
puts "i can fly."
end
end
class Hawk < Bird
def eat
puts "worms"
end
end
black = Hawk.new
black.fly


