Created
May 12, 2020 19:57
-
-
Save audy/c8bf7f7f7248f67524915720d1f006cc 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 BaseKitty | |
def meow | |
nil | |
end | |
end | |
class Nancy < BaseKitty | |
def meow | |
(super || "shshsh") | |
end | |
end | |
class SqueekKitty < BaseKitty | |
def meow | |
(super || "squeeeek") | |
end | |
end | |
class KittyMeowEnhander | |
def meow | |
["meow", "meow", "meowoowowow!!!"] | |
end | |
end | |
class MagicKitty < BaseKitty | |
include KittyMeowEnhancer | |
end | |
nancy = Nancy.new | |
squeeko = SqueekKitty.new | |
magic = SuperKitty.new | |
p nancy.meow | |
p squeeko.meow | |
p magic.meow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment