Skip to content

Instantly share code, notes, and snippets.

@ketanbhatt
Created September 23, 2018 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ketanbhatt/39ced93e3634fdbb6a579716d4cca0e7 to your computer and use it in GitHub Desktop.
Save ketanbhatt/39ced93e3634fdbb6a579716d4cca0e7 to your computer and use it in GitHub Desktop.
Strategy Pattern Blog: Code Snippets
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