Skip to content

Instantly share code, notes, and snippets.

@markson
Created April 8, 2013 07:22
Show Gist options
  • Save markson/5334875 to your computer and use it in GitHub Desktop.
Save markson/5334875 to your computer and use it in GitHub Desktop.
require 'pry'
class Animal
def initialize(name)
@name = name
end
def say()
begin
raise NotImplementedError, "something goes wrong"
rescue Exception
puts $!
end
end
end
class Cat < Animal
def say()
"#{@name}: Meow Meow!"
end
end
class Dog < Animal
def say()
"#{@name}: Wolf Wolf!"
end
end
class Bird < Animal
end
cat = Cat.new('Michael')
puts cat.say()
dog = Dog.new('Gof')
puts dog.say()
animal = Animal.new('alien')
puts animal.say()
bird = Bird.new('Jiji')
puts bird.say()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment