Last active
December 19, 2015 22:29
-
-
Save Lightpower/6027664 to your computer and use it in GitHub Desktop.
Interface
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
require "interface" | |
DuckInterface = interface { | |
required_methods :walk, :swim, :quack | |
} | |
class Duck | |
def walk | |
puts 'Duck walks' | |
end | |
def swim | |
puts 'Duck swims' | |
end | |
def quack | |
puts 'Duck quacks' | |
end | |
implements DuckInterface | |
end | |
class PteroDuck | |
def walk | |
puts 'PteroDuck walks' | |
end | |
def swim | |
puts 'PteroDuck swims' | |
end | |
def quack | |
puts 'PteroDuck quacks' | |
end | |
implements DuckInterface | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment