Created
September 23, 2018 03:45
-
-
Save ketanbhatt/39ced93e3634fdbb6a579716d4cca0e7 to your computer and use it in GitHub Desktop.
Strategy Pattern Blog: Code Snippets
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 Duck(object): | |
def quack(): | |
print "Quack! Quack!" | |
def swim(): | |
print "Yaay I am swimming!" | |
def display(): | |
raise NotImplementedError | |
class MallardDuck(Duck): | |
def display(): | |
print "I look like a Mallard" | |
class RedheadDuck(Duck): | |
def display(): | |
print "I look like a Redhead" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment