-
-
Save anonymous/3f4c00697b3cc2f0c47d 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 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