Created
August 2, 2017 01:51
-
-
Save Kevin-Kawai/4c0cc814352ef218ecfb746a081a1230 to your computer and use it in GitHub Desktop.
This file contains 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 Bird | |
attr_accessor :age | |
def initialize(age) | |
@age = age | |
end | |
def how_old | |
puts @age | |
end | |
end | |
class Eagle < Bird | |
attr_accessor :length | |
def initialize(length,age) | |
@length = length | |
super(age) | |
end | |
def how_long | |
puts @length | |
end | |
end | |
class Haast_Eagle < Eagle | |
def fact | |
puts "Giant eagle rumoured to eat people, extinct" | |
end | |
end | |
my_bird = Bird.new(14) | |
my_bird.how_old | |
my_eagle = Eagle.new(10,4) | |
my_eagle.how_long | |
my_eagle.how_old | |
my_haast_eagle = Haast_Eagle.new(9000,8000) | |
my_haast_eagle.fact | |
my_haast_eagle.how_old | |
my_haast_eagle.how_long |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment