Created
January 26, 2013 00:57
-
-
Save mlincoln/4639325 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| def initialize(name, calories) | |
| @name = name | |
| @calories = calories | |
| end | |
| # def name = (name) | |
| # @name = name | |
| # end | |
| #a def calories = (calories) | |
| # @calories = calories | |
| # end | |
| def healthy? | |
| if @calories < 200 | |
| return true | |
| else | |
| return false | |
| end | |
| end | |
| def delicious? | |
| return true | |
| end | |
| end | |
| class JellyBean < Dessert | |
| def initialize(name, calories, flavor) | |
| @name = name | |
| @calories = calories | |
| @flavor = flavor | |
| end | |
| # def flavor = (flavor) | |
| # @flavor = flavor | |
| # end | |
| def flavor | |
| return @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