Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2013 01:56
Show Gist options
  • Save anonymous/3f4c00697b3cc2f0c47d to your computer and use it in GitHub Desktop.
Save anonymous/3f4c00697b3cc2f0c47d to your computer and use it in GitHub Desktop.
class Dessert
attr_accessor :name
attr_accessor :calories
def initialize(name, calories)
@name = name
@calories = calories
end
def healthy?
self.calories < 200
end
def delicious?
self.class == Dessert
end
end
class JellyBean < Dessert
attr_accessor :flavor
def initialize(name, calories, flavor)
super(name, calories)
@flavour = flavor
end
def delicious?
if(flavor == "black licorice")
return false
else
return true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment